Is there a way to import playlist data from Google Play Music please?

Is there a way to import playlist data from Google Play Music please?

Comments

  • KoenKoen Administrator

    Playlists in Google Play Music works fundamentally different from playlists in Astiga (in Google Play Music, playlist items are pinned to a specific song; in Astiga they are pinned to a specific file path). Plus, the output of Google Takeout is localised to whatever your local language is, which makes parsing that information even more difficult. For that reason, it is not possible to import playlist data from Google Play Music directly.

    There are tools online however that can export Google Play Music playlists to M3U or PLS, and those can be imported in Astiga (with premium), however, I have never tested them and I have thus no idea how well they work (if at all).

  • Does anyone know what format those playlists are in? The only thing I have seen are Excel spreadsheets that have data on individual songs

  • MusicHorderMusicHorder Member
    edited September 7

    I am currently working through this issue, and the short answer is there is no easy way. In most cases (playlists with under 100 songs or only a few playlists, it'll be faster to just manually rebuild the playlist). I've been having trouble with step 13, but in theory, this should allow you to import your playlists.

    Long answer: It'll take some export/import work, a couple 3rd party apps, and some excel formulas.

    NOTE: I am still in the process of this and am having a hard time with the import, but hopefully someone else will be able to work through that.

    Key Requirement: The file structure of your export needs to match the file structure of the cloud storage provider you are using. So if you download all your files via Google Takeout, you will want to upload that structure as is to your cloud storage so that file paths match between local copies and cloud copies.

    Step 1: Export playlists from GPM - I used https://soundiiz.com/ to export the playlists only; however, I believe Google Takeout formats the playlist export the same way (title, artist, album, other metadata...).

    Step 2: Import music files into music player - For this, I used MusicBee. The player doesn't matter so much as it needs to have a playlist export function that creates a .m3u or .pls with file paths.

    Step 3: Export file locations of entire library - From your music player app of choice, create a playlist containing your entire music library and export that playlist as an .m3u or .pls. This will give you a master list of all your music files with the local file path.

    Step 4: Open GPM playlist export file - Open the playlist export file in excel, and filter for the playlist you want (select all, data > filter). Select all the tracks that are part of that playlist and copy all the data to a new workbook (Playlist File).

    Step 5: Merge datasources - In the new workbook (Playlist File), create a sheet called "Full Library". Open the playlist file from the music app that has all the file paths of your library and copy everything to the "Full Library" sheet in the new workbook.

    Save

    Step 6: Build the formulas - This method is based on doing a search of the library and returning the row that first matches. There are a few caviots to this method:

    • file names need to be an exact match
    • files with the same file name but different paths (i.e. /artist A/album 1/title.mp3 and /artist B/album 2/title.mp3) will return the first occurance, even if it's not the right file.

    Create a column called "File Path Row". In this column, put the formula =MATCH("*"&A2&"*",'Full Library'!$A$1:$A$14861,0) where A2 is the column of the track title and ,'Full Library'!$A$1:$A$14861 is the full range of all file paths. In this example, my library had 14861 rows of file paths. This formula will return the row number where a match was made. Copy this formula down for every title in the playlist (click and hold the little square in the corner and drag down to the bottom of the list). Any instances of #N/A means a match was not returned.

    Save

    Step 7: Refine the track names - In some cases, track names may not match the file name (common if you renamed the files or files had invalid characters for filenames (such as \ / , : ; etc.). Filter for files that didn't match (#N/A in the "File Path Column") and see if there are any special characters in the name or patterns. If there are, look what the substitution for that file and create a new column making that substitution (=SUBSTITUTE(A2,"[initial character]","[replacement character")). Copy down list.

    Save

    Step 8: Add on to formulas - Edit the "File Path Row" formula to include the adjust tract titles as well. This is done using the =IFNA() formula, so if you added a second column of adjusted track titles, your new formula would be =IFNA(MATCH("*"&A2&"*",'Full Library'!$A$1:$A$14861,0),MATCH("*"&B2&"*",'Full Library'!$A$1:$A$14861,0), where A2 is the first column of track titles, and B2 is the second column of adjusted track titles. You can extend this formula as long as needed. I needed to do one substitution and a trim of file name lenghts, so my final lookup formula looked like =IFNA(MATCH("*"&A2&"*",'Full Library'!$M$1:$M$14861,0),IFNA(MATCH("*"&B2&"*",'Full Library'!$M$1:$M$14861,0),MATCH("*"&C2&"*",'Full Library'!$M$1:$M$14861,0))).

    Save

    Step 9: Get file paths - In a new column, put the formula =INDIRECT(ADDRESS(P2,1,,,"Full Library")), where P2 is the "File Path Row" column and "Full Library" is the title of the sheet where the full list of library paths are. This formula will return the actual file path (the 1 being the column identifier). This formula is the foundation to find the file paths for the files in your playlist.

    Save

    Step 10: FIll in missing file paths - Copy your column with file names to a new column (pasting as values instead of formula). With the majority of files found, manually search for the remaining #N/A file paths and manually type them in this new column.

    Save

    Step 11: Verify playlist - once most or all the files have been located, copy the list of file paths into a new notepad text file. Each line should be a single file path. Save the file and rename the file extension to .m3u. Import the new playlist file into your local music player (MusicBee) and verify that all files show up. If there are any errors, fix and export again.

    Step 12: Adjust the file path - Once all files have been identified and verifed through your music app, export the new playlist. Open the file in Notepad and begin substitutions. Align the path so the top level aligns with the top level of you cloud provider and replace slashes.

    EX if you path is C:\Users\[username]\Music\Music Library\Artist Name\Ablumn Name\Track 1.mp3 and the "Music" folder is the top level folder in your cloud service, your new pathname would be Music Library/Artist Name/Ablumn Name/Track 1.mp3

    Step 13: Import the playlist - save the playlist file to the top level of your cloud service, search of it in Astiga, and import.

    EX Using C:\Users\[username]\Music\Music Library\Artist Name\Ablumn Name\Track 1.mp3 example, if the "Music" folder is the top level folder, that is where the playlist file would need to be saved in your cloud provider

    Post edited by MusicHorder on
  • Thanks @MusicHorder for all that time and effort. For that exporting I am also planning to look into https://musconv.com/how-it-works/ and https://gist.github.com/rhasselbaum/e1cf714e21f00741826f.

    First i need to understand how Astiga does playlists.

  • Thanks @Koen, especially for "(in Google Play Music, playlist items are pinned to a specific song; in Astiga they are pinned to a specific file path)".

    This helps understand how a playlist is defined in the two different systems and, the differences between those definitions.

    What exactly do you mean by a "playlist item" please?

  • jonb451jonb451 Member
    edited September 7

    @Koen Actually i see that Google's Takeout from their music includes playlists. It's a tree structure of files rather than the one file that i was expecting, but i'm relieved that means i have the data there. I can then data wrangle + code my way to whatever Astiga needs. I just need to know what that is.

    Is it a case of gettting it into an M3U or PLS format? Is that one file, or do we need to put a flag on the individual song files in our cloud storage (gDrive in my case)?

  • KoenKoen Administrator

    By playlist item I mean song, or audiobook, or a podcast episode whatever you have in your playlist.

    You can also look into https://asti.ga/developers/#playlists if you are going to create something to convert the playlists yourself, depending on your programming skills.

  • Thanks @Koen . Yes the python + json or xml suits me. For now i'm pursuing an alternative solution but thanks again and best of luck with this project. It's not open source and possible to follow on Github or somewhere is it?

  • KoenKoen Administrator

    Best of luck 😃

    The app is open source (https://github.com/Koenvh1/Subsonic/tree/astiga), the server is not.

Sign In or Register to comment.