Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare track artist along with album artist #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions spotify-sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down