From efabd1782cd1dbf081395e2a50d0707157e67c78 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 31 Jan 2022 17:33:08 +1300 Subject: [PATCH] 0.1.7 - Fix dupes --- docs/changelog.md | 1 + internal/goscrobble/ingress_jellyfin.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 73d5267e..552f009b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,6 @@ # 0.1.7 - Fix navidrome logging 2x scrobbles if second player is paused +- Fix jellyfin logging 2x scrobbles if 2 players are playing # 0.1.6 - Allow UUID of 0 in artists/{uuid}/top to return site-wide stats diff --git a/internal/goscrobble/ingress_jellyfin.go b/internal/goscrobble/ingress_jellyfin.go index bd1fbd19..ee777176 100644 --- a/internal/goscrobble/ingress_jellyfin.go +++ b/internal/goscrobble/ingress_jellyfin.go @@ -3,6 +3,7 @@ package goscrobble import ( "database/sql" "errors" + "fmt" "log" "net" "time" @@ -48,7 +49,7 @@ func ParseJellyfinInput(userUUID string, jf JellyfinRequest, ip net.IP, tx *sql. // fmt.Printf("%+v", jf) // Custom cache key - never log the same song twice in a row for now... (: - lastPlayedTitle := getUserLastPlayed(userUUID) + lastPlayedTitle := getUserLastPlayed(userUUID + fmt.Sprintf(":%s", jf.DeviceID)) if lastPlayedTitle == jf.Name+":"+jf.Album { // If it matches last played song, skip it return nil @@ -103,7 +104,7 @@ func ParseJellyfinInput(userUUID string, jf JellyfinRequest, ip net.IP, tx *sql. } // Add cache key! - setUserLastPlayed(userUUID, jf.Name+":"+jf.Album) + setUserLastPlayed(userUUID+fmt.Sprintf(":%s", jf.DeviceID), jf.Name+":"+jf.Album) return nil }