void playinfo_set_restartpos(const char *url, int64_t pos_ms) { kv_url_opt_set(url, KVSTORE_DOMAIN_SYS, "restartposition", pos_ms <= 0 ? KVSTORE_SET_VOID : KVSTORE_SET_INT64, pos_ms); update_by_url(url, 1); }
void playinfo_set_restartpos(const char *url, int64_t pos_ms, int unimportant) { int f = unimportant ? KVSTORE_UNIMPORTANT : 0; kv_url_opt_set(url, KVSTORE_DOMAIN_SYS, "restartposition", f | (pos_ms <= 0 ? KVSTORE_SET_VOID : KVSTORE_SET_INT64), pos_ms); update_by_url(url, 1); }
void playinfo_mark_urls_as(const char **urls, int num_urls, int seen) { for(int j = 0; j < num_urls; j++) { kv_url_opt_set(urls[j], KVSTORE_DOMAIN_SYS, "playcount", KVSTORE_SET_INT, seen); update_by_url(urls[j], 1); } }
void playinfo_register_play(const char *url, int inc) { int cur = kv_url_opt_get_int(url, KVSTORE_DOMAIN_SYS, "playcount", 0); kv_url_opt_set(url, KVSTORE_DOMAIN_SYS, "playcount", KVSTORE_SET_INT, cur + inc); kv_url_opt_set(url, KVSTORE_DOMAIN_SYS, "lastplayed", KVSTORE_SET_INT, (int)(time(NULL))); update_by_url(url, 1); }
static void metadb_set_playcount(void *opaque, prop_event_t event, ...) { metadb_item_prop_t *mip = opaque; va_list ap; if(event == PROP_DESTROYED) { mip_release(mip); return; } if(event != PROP_SET_INT) return; va_start(ap, event); int v = va_arg(ap, int); va_end(ap); kv_url_opt_set(mip->mip_url, KVSTORE_DOMAIN_SYS, "playcount", KVSTORE_SET_INT, v); update_by_url(mip->mip_url, 0); }