summaryrefslogtreecommitdiff
path: root/apps/plugins/lastfm_scrobbler.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lastfm_scrobbler.c')
-rw-r--r--apps/plugins/lastfm_scrobbler.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c
index 3269f1820b..5565eed4c5 100644
--- a/apps/plugins/lastfm_scrobbler.c
+++ b/apps/plugins/lastfm_scrobbler.c
@@ -101,15 +101,17 @@ static struct
101static struct 101static struct
102{ 102{
103 int savepct; 103 int savepct;
104 int beeplvl;
104 bool playback; 105 bool playback;
105 bool verbose; 106 bool verbose;
106} gConfig; 107} gConfig;
107 108
108static struct configdata config[] = 109static struct configdata config[] =
109{ 110{
110 {TYPE_INT, 0, 100, { .int_p = &gConfig.savepct }, "SavePct", NULL}, 111 {TYPE_INT, 0, 100, { .int_p = &gConfig.savepct }, "SavePct", NULL},
111 {TYPE_BOOL, 0, 1, { .bool_p = &gConfig.playback }, "Playback", NULL}, 112 {TYPE_BOOL, 0, 1, { .bool_p = &gConfig.playback }, "Playback", NULL},
112 {TYPE_BOOL, 0, 1, { .bool_p = &gConfig.verbose }, "Verbose", NULL}, 113 {TYPE_BOOL, 0, 1, { .bool_p = &gConfig.verbose }, "Verbose", NULL},
114 {TYPE_INT, 0, 10, { .int_p = &gConfig.beeplvl }, "BeepLvl", NULL},
113}; 115};
114const int gCfg_sz = sizeof(config)/sizeof(*config); 116const int gCfg_sz = sizeof(config)/sizeof(*config);
115/****************** config functions *****************/ 117/****************** config functions *****************/
@@ -118,6 +120,7 @@ static void config_set_defaults(void)
118 gConfig.savepct = 50; 120 gConfig.savepct = 50;
119 gConfig.playback = false; 121 gConfig.playback = false;
120 gConfig.verbose = true; 122 gConfig.verbose = true;
123 gConfig.beeplvl = 10;
121} 124}
122 125
123static int config_settings_menu(void) 126static int config_settings_menu(void)
@@ -135,6 +138,7 @@ static int config_settings_menu(void)
135 ID2P(LANG_RESUME_PLAYBACK), 138 ID2P(LANG_RESUME_PLAYBACK),
136 "Save Threshold", 139 "Save Threshold",
137 "Verbose", 140 "Verbose",
141 "Beep Level",
138 ID2P(VOICE_BLANK), 142 ID2P(VOICE_BLANK),
139 ID2P(LANG_CANCEL_0), 143 ID2P(LANG_CANCEL_0),
140 ID2P(LANG_SAVE_EXIT)); 144 ID2P(LANG_SAVE_EXIT));
@@ -153,12 +157,15 @@ static int config_settings_menu(void)
153 case 2: 157 case 2:
154 rb->set_bool("Verbose", &gConfig.verbose); 158 rb->set_bool("Verbose", &gConfig.verbose);
155 break; 159 break;
156 case 3: /*sep*/ 160 case 3:
161 rb->set_int("Beep Level", "", UNIT_INT,
162 &gConfig.beeplvl, NULL, 1, 0, 10, NULL);
163 case 4: /*sep*/
157 continue; 164 continue;
158 case 4: 165 case 5:
159 return -1; 166 return -1;
160 break; 167 break;
161 case 5: 168 case 6:
162 { 169 {
163 int res = configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER); 170 int res = configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER);
164 if (res >= 0) 171 if (res >= 0)
@@ -469,7 +476,8 @@ void thread(void)
469 /*fall through*/ 476 /*fall through*/
470 case EV_STARTUP: 477 case EV_STARTUP:
471 events_register(); 478 events_register();
472 rb->beep_play(1500, 100, 1000); 479 if (gConfig.beeplvl > 0)
480 rb->beep_play(1500, 100, 100 * gConfig.beeplvl);
473 break; 481 break;
474 case SYS_POWEROFF: 482 case SYS_POWEROFF:
475 case SYS_REBOOT: 483 case SYS_REBOOT:
@@ -595,6 +603,8 @@ enum plugin_status plugin_start(const void* parameter)
595 if (scrobbler_init() < 0) 603 if (scrobbler_init() < 0)
596 return PLUGIN_ERROR; 604 return PLUGIN_ERROR;
597 605
606 config_set_defaults();
607
598 if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0) 608 if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0)
599 { 609 {
600 /* If the loading failed, save a new config file */ 610 /* If the loading failed, save a new config file */