From 85fd136b1cca1e55cae66f42bafe611fbd34dfdd Mon Sep 17 00:00:00 2001 From: Brahma Dev Date: Mon, 11 Oct 2021 23:11:54 +0200 Subject: [PATCH 1/2] Compare track artist along with album artist --- spotify-sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotify-sync.py b/spotify-sync.py index c539b2c..b7826a8 100644 --- a/spotify-sync.py +++ b/spotify-sync.py @@ -18,7 +18,7 @@ def filterPlexArray(plexItems=[], song="", artist="") -> List[Track]: plexItems.remove(item) continue artistItem = item.artist() - if artistItem.title.lower() != artist.lower(): + if str(item.originalTitle).lower() != artist.lower() and artistItem.title.lower() != artist.lower(): plexItems.remove(item) continue From 645ab4424aef94d7cc1cbfe2f230b4aa4b8e95ce Mon Sep 17 00:00:00 2001 From: Brahma Dev Date: Tue, 12 Oct 2021 11:48:51 +0200 Subject: [PATCH 2/2] Compare all artists associated with the track. --- spotify-sync.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/spotify-sync.py b/spotify-sync.py index b7826a8..7439fee 100644 --- a/spotify-sync.py +++ b/spotify-sync.py @@ -62,20 +62,21 @@ def getPlexTracks(plex: PlexServer, spotifyTracks: []) -> List[Track]: track = spotifyTrack['track'] logging.info("Searching Plex for: %s by %s" % (track['name'], track['artists'][0]['name'])) - try: - musicTracks = plex.search(track['name'], mediatype='track') - except: + for artist in track['artists']: try: musicTracks = plex.search(track['name'], mediatype='track') except: - logging.info("Issue making plex request") - continue - - if len(musicTracks) > 0: - plexMusic = filterPlexArray(musicTracks, track['name'], track['artists'][0]['name']) - if len(plexMusic) > 0: - logging.info("Found Plex Song: %s by %s" % (track['name'], track['artists'][0]['name'])) - plexTracks.append(plexMusic[0]) + try: + musicTracks = plex.search(track['name'], mediatype='track') + except: + logging.info("Issue making plex request") + break + if len(musicTracks) > 0: + plexMusic = filterPlexArray(musicTracks, track['name'], artist['name']) + if len(plexMusic) > 0: + logging.info("Found Plex Song: %s by %s" % (track['name'], artist['name'])) + plexTracks.append(plexMusic[0]) + break return plexTracks