Google again, decided to kill another product.  This time it was Google Play Music  (GPM) and a forced migration to a inferior YouTube Music app.

I had enough and decided to just host it myself on Plex.

Getting playlists out of GPM is a bit of a pain.  There's an unofficial GPM python API, but it didn't seem to grab my entire playlist (only 32/134 songs).

Used the following items to get it to work:

import pandas as pd
df = pd.read_csv('songlist.txt') #assume the csv is named songlist.txt

#modify the compare function (took out a few things)
def compare(ggmusic, pmusic):
    """
    Parameters
    ----------
    ggmusic (dict): Contains Playlist data from Google Music
    pmusic (object): Plex item found from search

    Returns
    -------
    pmusic (object): Matched Plex item
    """
    title = str(ggmusic['title'])
    album = str(ggmusic['album'])
    #tracknum = int(ggmusic['track']['trackNumber'])
    duration = ggmusic['duration']

    # Check if track numbers match
    #if int(pmusic.index) == int(tracknum):
    #    return [pmusic]
    # If not track number, check track title and album title
    if title == pmusic.title and (album == pmusic.parentTitle or
                                    album.startswith(pmusic.parentTitle)):
        return [pmusic]
    # Check if track duration match
    #elif round_down(duration, 1000) == round_down(pmusic.duration, 1000):
    #    return [pmusic]
    # Lastly, check if title matches
    elif title == pmusic.title:
        return [pmusic]
        
### Modify the main() to fit my needs:
playlistContent = []
shareToken = pl['shareToken']
# Go through tracks in Google Music Playlist
for index,row in df.iterrows():
    title = row['title']
    album = row['album']
    artist = row['artist']
    ggmusic = row
    # Search Plex for Album title and Track title
    albumTrackSearch = plex.library.section(MUSIC_LIBRARY_NAME).searchTracks(
            **{'album.title': album, 'track.title': title})
    # Check results
    if len(albumTrackSearch) == 1:
        playlistContent += albumTrackSearch
    if len(albumTrackSearch) > 1:
        for pmusic in albumTrackSearch:
            albumTrackFound = compare(ggmusic, pmusic)
            if albumTrackFound:
                playlistContent += albumTrackFound
                break
    # Nothing found from Album title and Track title
    if not albumTrackSearch or len(albumTrackSearch) == 0:
        # Search Plex for Track title
        trackSearch = plex.library.section(MUSIC_LIBRARY_NAME).searchTracks(
                **{'track.title': title})
        if len(trackSearch) == 1:
            playlistContent += trackSearch
        if len(trackSearch) > 1:
            for pmusic in trackSearch:
                trackFound = compare(ggmusic, pmusic)
                if trackFound:
                    playlistContent += trackFound
                    break
        # Nothing found from Track title
        if not trackSearch or len(trackSearch) == 0:
            # Search Plex for Artist
            artistSearch = plex.library.section(MUSIC_LIBRARY_NAME).searchTracks(
                    **{'artist.title': artist})
            for pmusic in artistSearch:
                artistFound = compare(ggmusic, pmusic)
                if artistFound:
                    playlistContent += artistFound
                    break
            if not artistSearch or len(artistSearch) == 0:
                print(u"Could not find in Plex:\n\t{} - {} {}".format(artist, album, title))
print("Adding Playlist: {}".format(playlistName))
plex.createPlaylist(playlistName, playlistContent)

Products that have Google killed that I used and where I migrated them to:

Products that I should move before they disappear:

Full list of dead Google "Products":

Killed by Google
Killed by Google is the open source list of dead Google products, services, and devices. It serves as a tribute and memorial of beloved services and products killed by Google.