Beispiel #1
0
static void
mip_get(const char *url, metadb_item_info_t *mii)
{
  mii->mii_playcount  =
    kv_url_opt_get_int(url, KVSTORE_DOMAIN_SYS, "playcount", 0);

  mii->mii_lastplayed =
    kv_url_opt_get_int(url, KVSTORE_DOMAIN_SYS, "lastplayed", 0);

  mii->mii_restartpos =
    kv_url_opt_get_int64(url, KVSTORE_DOMAIN_SYS, "restartposition", 0);
}
Beispiel #2
0
static JSBool 
js_createBool(JSContext *cx, JSObject *obj, uintN argc, 
	      jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  JSBool def;
  JSBool persistent = JS_FALSE;
  JSObject *func;

  if(!JS_ConvertArguments(cx, argc, argv, "ssbo/b",
			  &id, &title, &def, &func, &persistent))
    return JS_FALSE;

  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  if(persistent && jsg->jsg_kv_url)
    def = kv_url_opt_get_int(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, 
			     id, def);

  jss->jss_s =
    settings_create_bool(jsg->jsg_root, id, _p(title),
			 def, jsg->jsg_store,
			 js_store_update_bool, jss,
			 SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,
			 js_global_pc,
			 js_setting_group_save, jsg);
  jss->jss_cx = NULL;

  return JS_TRUE;
}
Beispiel #3
0
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);
}
Beispiel #4
0
static JSBool 
js_createInt(JSContext *cx, JSObject *obj, uintN argc, 
		jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  int def;
  int min;
  int max;
  int step;
  const char* unit;
  JSObject *func;
  JSBool persistent = JS_FALSE;

  if(!JS_ConvertArguments(cx, argc, argv, "ssiiiiso/b",
			  &id, &title, &def, &min, &max, &step, &unit, &func,
			  &persistent)){
    return JS_FALSE;
  }


  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  if(persistent && jsg->jsg_kv_url)
    def = kv_url_opt_get_int(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, 
			     id, def);
  jss->jss_s =
    setting_create(SETTING_INT, jsg->jsg_root,
                   SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,

                   SETTING_TITLE_CSTR(title),
                   SETTING_VALUE(def),
                   SETTING_RANGE(min, max),
                   SETTING_STEP(step),
                   SETTING_UNIT_CSTR(unit),
                   SETTING_COURIER(js_global_pc),
                   SETTING_CALLBACK(js_store_update_int, jss),
                   SETTING_HTSMSG_CUSTOM_SAVER(id, jsg->jsg_store,
                                               js_setting_group_save, jsg),
                   NULL);
  jss->jss_cx = NULL;

  return JS_TRUE;
}