Closed pjft closed 4 years ago
So you touch Google Music twice, once for the Playlist tracks and then again or the tracks. I haven't tested this yet.
get_shared_playlist_contents
returned Playlists that contain uploaded music where other methods included purchased or free tracks that were added to a Playlist, IIRC or it was the first method I found that did that. I'll have to test.
Thanks for the feedback. Once again, first incursion in python - unsure if this is what you expected on the dictionary front.
Also, added the declaration/instancing of GGMUSICLIST to after the authentication part because it'd fail miserably if we weren't authenticated, I imagine? As for the behavior, I have a free account, all playlists created by myself, mostly uploaded tracks, some purchased. This seemed to be the way it'd work for me. A simple way I got to troubleshoot it was to run
print("Playlist length: {}".format(len(mc.get_shared_playlist_contents(shareToken)))) print("Playlist SOURCE length: {}".format(len(pl['tracks'])))
and in many cases there was a difference there (the SOURCE would always be the same number or larger than the one from get_shared_playlist_contents(shareToken), and the correct number from what I could tell).
Hope this helps, but once again, your mileage may vary. Just wanted to share in case it'd help.
Without looking through each playlist and matching everything, it looks like your version at least got more matches than mine. I like the idea of adding a printout of the amount in the Google Playlist to the amount that made it into the Plex playlist.
print("Adding Playlist: {}".format(playlistName))
print("Google Music Playlist: {}, has {} tracks. {} tracks were added to Plex.".format(
playlistName, len(pl['tracks']), len(playlistContent)))
plex.createPlaylist(playlistName, playlistContent)
also you need to add Author: Blacktwin, pjft
And @sdlynx had a valid addition to check if anything was matched or not.
So then Author: Blacktwin, pjft, sdlynx
:)
Sorry for the delay, here are the last updates!
I don't quite know what exactly the change from @sdlynx is, apologies, but hopefully it's just adding that in a separate commit :)
Hope this still helps as I imagine the Google Music sunset is around the corner.
Hi, and thank you for putting this script together. Especially critical when Google Music is sunsetting and I'm (like many others) migrating to Plex.
I ran this today on my end but ran into a few issues, so after some changes it now works for me. Unsure if something changed on any of the APIs, so feel free to disregard, but I thought I'd give back since it might be useful for you or others.
In the original version of the script two things are failing for me using Python 3.6:
get_shared_playlist_contents(shareToken)
was incorrect on multiple (if not all?) occasions on my end. The info in the playlist fromget_all_user_playlist_contents()
was correct, though, so I end up getting thetrackId
and then (very inefficiently, but effectively as apparently there's no API method for that) get the exact track by Id and get the metadata.These seemed to work for me - at least I seem to have successfully imported my 173 playlists just now, which was driving my crazy (bar the odd "track not found" or poor match because of Plex metadata). But certainly a vastly better hit rate than before.
So thank you so much, and I hope this is helpful!
P.S. - I never coded in Python, so apologies if I messed something up tremendously, or made any style or semantics errors there. Feel free to adjust and change at will. Also, as I had to clean my code up myself after getting it to work, I don't think I made any unnecessary deletions from my changes but if I did, I apologize in advance!