From 9a47335a059230d72e0c46c6c69d4930b05532d9 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 8 Sep 2018 08:32:49 +0200 Subject: [PATCH 1/2] [player] Only increment playcount and scrobble persistent items Ommits useless update query for playcount for items that are not in the library. Also avoids trying to scrobble these items (fixes error log message "lastfm: Scrobble failed, track id 9999999 is unknown") --- src/player.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/player.c b/src/player.c index b39ce4bc..10dfd3d6 100644 --- a/src/player.c +++ b/src/player.c @@ -811,10 +811,15 @@ source_check(void) i++; id = (int)cur_playing->id; - worker_execute(playcount_inc_cb, &id, sizeof(int), 5); + + if (id != DB_MEDIA_FILE_NON_PERSISTENT_ID) + { + worker_execute(playcount_inc_cb, &id, sizeof(int), 5); #ifdef LASTFM - worker_execute(scrobble_cb, &id, sizeof(int), 8); + worker_execute(scrobble_cb, &id, sizeof(int), 8); #endif + } + history_add(cur_playing->id, cur_playing->item_id); if (consume) From 461a1d55bfe35a30ce1bdad96939711dc6a7d7cc Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 8 Sep 2018 09:14:24 +0200 Subject: [PATCH 2/2] [player] Only add persistent items to history The current logic in httpd_dacp.c cannot handle non persistent items correctly. The items are always shown with the dummy_mfi with "unkown artist" etc. --- src/player.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/player.c b/src/player.c index 10dfd3d6..1fb0f017 100644 --- a/src/player.c +++ b/src/player.c @@ -818,10 +818,9 @@ source_check(void) #ifdef LASTFM worker_execute(scrobble_cb, &id, sizeof(int), 8); #endif + history_add(cur_playing->id, cur_playing->item_id); } - history_add(cur_playing->id, cur_playing->item_id); - if (consume) db_queue_delete_byitemid(cur_playing->item_id);