diff options
Diffstat (limited to 'apps/plugins/lastfm_scrobbler.c')
-rw-r--r-- | apps/plugins/lastfm_scrobbler.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c index 5565eed4c5..dce6be0d1e 100644 --- a/apps/plugins/lastfm_scrobbler.c +++ b/apps/plugins/lastfm_scrobbler.c @@ -98,7 +98,7 @@ static struct bool force_flush; } gCache; -static struct +static struct lastfm_config { int savepct; int beeplvl; @@ -528,7 +528,7 @@ void thread_quit(void) } /* callback to end the TSR plugin, called before a new one gets loaded */ -static bool exit_tsr(bool reenter) +static int exit_tsr(bool reenter) { MENUITEM_STRINGLIST(menu, ID2P(LANG_AUDIOSCROBBLER), NULL, ID2P(LANG_SETTINGS), "Flush Cache", "Exit Plugin", ID2P(LANG_BACK)); @@ -556,19 +556,13 @@ static bool exit_tsr(bool reenter) case 2: /* exit plugin - quit */ if(rb->gui_syncyesno_run(&quit_prompt, NULL, NULL) == YESNO_YES) { + scrobbler_flush_cache(); thread_quit(); - if (reenter) - rb->plugin_tsr(NULL); /* remove TSR cb */ - return !reenter; + return (reenter ? PLUGIN_TSR_TERMINATE : PLUGIN_TSR_SUSPEND); } - - if(!reenter) - return false; - - break; - + /* Fall Through */ case 3: /* back to menu */ - return false; + return PLUGIN_TSR_CONTINUE; } } } @@ -576,7 +570,17 @@ static bool exit_tsr(bool reenter) /****************** main ******************/ static int plugin_main(const void* parameter) { - (void)parameter; + struct lastfm_config cfg; + rb->memcpy(&cfg, & gConfig, sizeof(struct lastfm_config)); + + /* Resume plugin ? */ + if (parameter == rb->plugin_tsr) + { + + gConfig.beeplvl = 0; + gConfig.playback = false; + gConfig.verbose = false; + } rb->memset(&gThread, 0, sizeof(gThread)); if (gConfig.verbose) @@ -586,9 +590,11 @@ static int plugin_main(const void* parameter) rb->plugin_tsr(exit_tsr); /* stay resident */ thread_create(); + rb->memcpy(&gConfig, &cfg, sizeof(struct lastfm_config)); if (gConfig.playback) return PLUGIN_GOTO_WPS; + return PLUGIN_OK; } |