forked from len0rd/rockbox
[BugFix] last fm scrobbler not saving pending tracks on shutdown
Change-Id: If7b03220c466ccf3f27cdf13d2e0b50d6a312bdc
This commit is contained in:
parent
1c80f53581
commit
e60ade1fbc
2 changed files with 8 additions and 2 deletions
|
@ -261,6 +261,7 @@ static int playback_callback(int action,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
|
(void)this_item;
|
||||||
}
|
}
|
||||||
/* PLAYBACK MENU */
|
/* PLAYBACK MENU */
|
||||||
/***********************************/
|
/***********************************/
|
||||||
|
|
|
@ -575,6 +575,7 @@ static int create_log_entry(const struct mp3entry *id,
|
||||||
|
|
||||||
static void scrobbler_add_to_cache(const struct mp3entry *id)
|
static void scrobbler_add_to_cache(const struct mp3entry *id)
|
||||||
{
|
{
|
||||||
|
logf("%s", __func__);
|
||||||
int trk_info_len = 0;
|
int trk_info_len = 0;
|
||||||
|
|
||||||
if (id->elapsed < (unsigned long) gConfig.minms)
|
if (id->elapsed < (unsigned long) gConfig.minms)
|
||||||
|
@ -663,6 +664,7 @@ static void scrobbler_flush_cache(void)
|
||||||
/* Add any pending entries to the cache */
|
/* Add any pending entries to the cache */
|
||||||
if (gCache.pending)
|
if (gCache.pending)
|
||||||
{
|
{
|
||||||
|
logf("SCROBBLER: pending entry");
|
||||||
gCache.pending = false;
|
gCache.pending = false;
|
||||||
if (rb->audio_status())
|
if (rb->audio_status())
|
||||||
scrobbler_add_to_cache(rb->audio_current_track());
|
scrobbler_add_to_cache(rb->audio_current_track());
|
||||||
|
@ -762,20 +764,23 @@ void thread(void)
|
||||||
in_usb = false;
|
in_usb = false;
|
||||||
/*fall through*/
|
/*fall through*/
|
||||||
case EV_STARTUP:
|
case EV_STARTUP:
|
||||||
|
logf("SCROBBLER: Thread Started");
|
||||||
events_register();
|
events_register();
|
||||||
play_tone(1500, 100);
|
play_tone(1500, 100);
|
||||||
break;
|
break;
|
||||||
case SYS_POWEROFF:
|
case SYS_POWEROFF:
|
||||||
|
logf("SYS_POWEROFF");
|
||||||
|
/*fall through*/
|
||||||
case SYS_REBOOT:
|
case SYS_REBOOT:
|
||||||
gCache.force_flush = true;
|
gCache.force_flush = true;
|
||||||
/*fall through*/
|
/*fall through*/
|
||||||
case EV_EXIT:
|
case EV_EXIT:
|
||||||
#if USING_STORAGE_CALLBACK
|
#if USING_STORAGE_CALLBACK
|
||||||
rb->unregister_storage_idle_func(scrobbler_flush_callback, false);
|
rb->unregister_storage_idle_func(scrobbler_flush_callback, false);
|
||||||
#else
|
#endif
|
||||||
if (!in_usb)
|
if (!in_usb)
|
||||||
scrobbler_flush_cache();
|
scrobbler_flush_cache();
|
||||||
#endif
|
|
||||||
events_unregister();
|
events_unregister();
|
||||||
return;
|
return;
|
||||||
case EV_FLUSHCACHE:
|
case EV_FLUSHCACHE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue