rnagabhyrava / plex-playlist-sync

App to recreate spotify/deezer playlists in your local plex server.
GNU General Public License v3.0
173 stars 24 forks source link

Remastered album name shenanigans #38

Open sawasy opened 2 years ago

sawasy commented 2 years ago

Did you search the existing issue to make sure this is not a duplicate? Yes. I didn't see anything

Is your feature request related to a problem? Please describe. Syncing from Spotify to Plex works amazingly well. Kudos! There is one small rub, however. Spotify seems to have the remastered albums instead of the original album. My Plex library has original albums. Because of this, the script isn't matching the album because the album name has something like "Remastered" in the name. Examples:

Van Halen,1984 (Remastered)
Nick Cave & The Bad Seeds,Let Love In (2011 Remastered Version)
Led Zeppelin, Led Zeppelin II (1994 Remaster)
Ultramagnetic MC's, Critical Beatdown (Re-Issue)

Describe the solution you'd like Would some sort of fuzzy matching on the album name be an option?

Describe alternatives you've considered If I add these songs in by hand to the playlist, the next run of the script will delete and rebuild the playlist, so this doesn't work.

Additional context N/A

m!

rnagabhyrava commented 2 years ago

This is possible. The easiest way would be to perform a second match here where album name would be everything before "(".

https://github.com/rnagabhyrava/plex-playlist-sync/blob/8bf2454fd518bde526c42a0c461dd86d2735bea4/plex-playlist-sync/utils/plex.py#L92

Following is more of a note to self.

In cases where plex returns same tracks with different albums, Let Albums be A and A (remastered). With current process whatever first matches on artist or album will be added, and search will break the loop.

Doing this will cause unwanted matches (If user is searching for A, and plex returns A (remastered) as first result and A as second). If doing extra check as needed here with album name split "(" [0], The program will find A(remastered) as match and call it a day.

To avoid this, a complete check must be performed on all the results and best match should be added to playlist. This can take a little bit longer to run as similarity should be checked on at most 10 of the queries. May need to consider an environment variable to perform this extra match,

rnagabhyrava commented 2 years ago

On a side note, Match is based on artist as preference and then album name. If artists are a match tracks should match. Do you have artists tagged properly?

sawasy commented 2 years ago

On a side note, Match is based on artist as preference and then album name. If artists are a match tracks should match. Do you have artists tagged properly?

I am using beets to manage the library, so the tagging is done automatically. I have just spot checked and the tags are correct.

Doing this will cause unwanted matches (If user is searching for A, and plex returns A (remastered) as first result and A as second). If doing extra check as needed here with album name split "(" [0], The program will find A(remastered) as match and call it a day.

It would be a little more cpu overhead, bit if you threw a sort on the results, the unmastered version would always be ahead of the remastered version. :)

m!

sawasy commented 2 years ago

Unrelated to the above, but I thought I'd add a note to document this issue. I was having a problem where the user_playlists function wasn't returning all of my 'public' playlists. Digging through your code, spotipy and the Spotify Developer console, I discovered a quirk of the oauth2 scope being used.

The tl;dr is that if you mark a playlist as public it will not be picked up in this scope unless it is ALSO added to your profile. It was so confusing to see the playlist saying public in the Spotify app but having http call return public = false.

m!

sawasy commented 2 years ago

I have encountered another miss. Spotify has

Cherub Rock - Remastered 2011 where I have Cherub Rock Perhaps also matching on $ALBUM_NAME( - [Rr]emastered \d\d\d\d)?

m!