Method for importing Google Play Music playlists into MM

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

boulderburner
Posts: 1
Joined: Thu Mar 24, 2016 10:34 am
Contact:

Method for importing Google Play Music playlists into MM

Post by boulderburner »

Hi there, first post, sorry if this is in the wrong section - please feel free to relocate if so.

I use both MediaMonkey (at home, for streaming to home stereos and music file organization) and Google Play Music (at work, anywhere I'm mobile.) I have been doing all of my playlist creation and editing in Google Play Music since I usually do it while I'm listening to music while at work, travelling, etc. The problem with that was I put a lot of time into some pretty extensive playlists that weren't accessible if I wanted to use MediaMonkey for streaming at home (which I do, since Google Play Music is pretty feature poor and I don't want to have to rely on external internet connection while streaming media at home.) Of course Google doesn't have any good tools for exporting playlists from their app because they don't want you using anything but their app. I came up with the following method for getting my playlists created in Google imported into MediaMonkey and thought I'd post it here in case anyone else had the same problem I do.

The following steps assume that all songs in Google Play Music playlists exist in the MediaMonkey library (with same tagged track name and title) and that there is a matching playlist name in Media Monkey for each Google Playlist to import. If not, add the necessary files to MM and create the playlist names in MM. Also, before beginning, make sure your MediaMonkey library is up to date and ensure that MediaMonkey is not running when executing the steps below.

To complete the steps, you will need a way to run SQLite Queries against the databases and be able to export/import the result sets. I use SQLite Administrator due to its ability to choose the delimiter when exporting CSV, but pretty much any SQLite tool will work if you know how to use it. Using a comma as a delimiter can be problematic since many song or artist names may have a comma. I use | as a delimiter, which seems to work well. You can download SQLAdmin from here: http://sqliteadmin.orbmu2k.de/

Due to the text collation type used in the songs table of the Media Monkey Database, it's impossible to directly execute some of the multi-db join SQL updates that are required against the MM.db, so to get around that limitation, we will export the data we need from both databases, import that data into a temporary db, join the data and then import the joined data into the MM.db.

Steps:

1. Get your Google music.db following the instructions in the link below. Only steps 1 and 2 are needed (note the first step has numbered bullet points, don’t stop at bullet point

http://laviefrugale.blogspot.com/2012/0 ... music.html

2. Using a SQLite query tool* run the following query against the google music.db and export the result of the query above to a value separated file (.csv) named gplaylistdata.csv

select name as "Playlist Name", artist, title from listitems join music on listitems.musicid = music.id join lists on listitems.listid = lists.id order by "Playlist Name", "Artist";

3. Make a backup copy of Media Monkey database (the file is in the location below)

C:\Users\YourNameHere\AppData\Roaming\MediaMonkey (the database will be called MM.db)

4. Run the following queries against MM.db and export the results to value separated files named mmplaylists.csv and mmsongs.csv respectively.

select IDPlaylist, PlaylistName from playlists; (export to mmplaylists.csv)

select ID, Artist, SongTitle from Songs; (export to mmsongs.csv)

5. Create a temporary database using your SQLite tool. Use the following sql commands to create tables in the temp db.

CREATE TABLE gplaylistdata ("PlaylistName" TEXT NOT NULL, "Artist" TEXT NOT NULL, "Title" TEXT NOT NULL, "SongID" INTEGER, "PlaylistID" INTEGER);

CREATE TABLE mmplaylists ("IDPlaylist" INTEGER, "PlaylistName" TEXT);

CREATE TABLE mmsongs ("ID" INTEGER, "Artist" TEXT, "SongTitle" TEXT);

CREATE TABLE mmplaylistsongs (“IDPlaylistSong" INTEGER, "IDPlaylist" INTEGER, "IDSong" INTEGER, "SongOrder" INTEGER);


6. Import the gplaylistdata.csv, mmplaylists.csv, and mmsongs.csv files into their respective tables in the temp db - ensure that the columns match up. Note: depending on the number of songs in the MM.db, this might take several minutes.

7. Execute the following queries against the temp db to populate the gplaylist data table with matching media monkey playlist and song IDs.

update gplaylistdata set SongID = (select mmsongs.ID from mmsongs where mmsongs.SongTitle=gplaylistdata.Title and mmsongs.Artist=gplaylistdata.Artist) where exists (select * from mmsongs where mmsongs.SongTitle=gplaylistdata.Title and mmsongs.Artist=gplaylistdata.Artist); *this query might take a while for large databases*

update gplaylistdata set PlaylistID = (select IDPlaylist from mmplaylists where mmplaylists.PlaylistName=gplaylistdata.PlaylistName) where exists (select IDPlaylist from mmplaylists where mmplaylists.PlaylistName=gplaylistdata.PlaylistName);

8. Run the following query against the temp db and export the results to value separated file named mmplaylistsongs.csv

select SongID as IDSong, PlaylistID as IDPlaylist from gplaylistdata where SongID is not null and PlaylistID is not null;

9. Open the MediaMonkey database (MM.db) and import the mmplaylistsongs.csv into the PlaylistSongs table **make sure that the fields match up - IDSong should not be matched with IDPlayListSong which is an auto-increment key field. Depending on what data you already have in this table, you may want to clear it first.

10. Open Media Monkey – your playlists should be there and usable!

I hope this is useful for someone, it definitely is useful for me! Cheers!