···11# gpm-to-itunes
22Adds your GPM library to iTunes.
3344-Your tracks' date added and play count will be kept. Last played date, year, album artist, composer, comment, track number, track count, genre, disc number and disc count should be kept as well.
44+Your tracks' date added and play counts will be kept, as well as last played date, year, album artist, composer, comment, track number, track count, genre, disc number and disc count is kept as well.
5566-If you have any tracks already in iTunes, they will be matched with GPM tracks so that you don't end up with duplicates. If this happens, the version in iTunes will be kept. If the iTunes track's mp3 file is missing, this will be fixed. The play counts will be combined. The "played date" that is the most recent will be used. The iTunes track's "date added" will always be used. The GPM track's year, album artist, composer, comment, track number, track count, genre, disc number, disc count, title, artist and album will be used.
66+If you have any tracks already in iTunes, they will be matched with GPM tracks so that you don't end up with duplicates. If this happens:
77+- The iTunes file and "date added" will be kept
88+- The play counts will be combined
99+- The most recent "played date" will be used
1010+- The GPM track's year, album artist, composer, comment, track number, track count, genre, disc number, disc count, title, artist and album will be used.
711812In iTunes, a playlist folder named "GPM PLAYLISTS" will be created. GPM user playlists will be added into it.
9131010-GPM tracks will not keep their thumbs up or thumbs down ratings when they're added to iTunes. Instead, they will be added to two playlists that will be created, named "GPM Thumbs Up" and "GPM Thumbs Down". They will also be inside the "GPM PLAYLISTS" playlist folder.
1414+GPM tracks will not keep their thumbs up or thumbs down ratings when they're added to iTunes. Instead, they will be added to two playlists that will be created, named "GPM Thumbs Up" and "GPM Thumbs Down". They will be put inside the "GPM PLAYLISTS" playlist folder.
11151216# Guide
13171. Setup
···1721 1. Run `python3 -m pip install gmusicapi appscript mp3_tagger tqdm` to install some stuff gpm-to-itunes needs.
1822 1. Create the `options.py` file. Follow the example shown below.
19231. Download
2020- 1. Run `python3 main.py login` to log in to GPM.
2121- 1. Run `python3 main.py download`. This will download and save your GPM library's metadata to `library_downloaded.json`.
2222- 1. Run `python3 main.py restructure`. This just does some changes to `library_downloaded.json` and saves the new version as `library_restructured.json`.
2424+ 1. Run `python3 main.py login` to log in to GPM. Instructions will be shown.
2525+ 1. Run `python3 main.py fetch`. This downloads metadata from GPM and restructures it.
2326 1. Download your GPM library's songs to a folder using [Music Manager](https://play.google.com/music/listen#/manager). This can take hours. Don't move this folder anywhere before you're done with gpm-to-itunes.
2424-1. Run `python3 main.py match_files <songs_path>`. songs_path is the path of the folder you downloaded your GPM library's songs to in the last step. This will connect the songs you downloaded and the metadata we downloaded earlier.
2525-1. If you have tracks that exist in both iTunes and GPM
2626-2727-2828-2929-1. If you have any tracks that exist in both iTunes and GPM, but with different titles, artists or albums, you can create an `md_map.json` file, example shown below. This will make gpm-to-itunes match these songs together, so that you don't end up with duplicates.
3030-11. If you have tracks in iTunes, run `python3 main.py scan_itunes` (Optional but recommended). This will tell you when it finds tracks that already exist in your GPM library. It will also tell you if there are duplicate tracks in iTunes (tracks with equal titles, artists and albums), which you might not want. At the end, it will tell you what tracks in iTunes don't match up with any GPM track - And it logs these in the format `md_map.json` accepts, because you might want to consider adding them there.
3131-12. If you use `md_map.json`, run `python3 check.py` (Optional but recommended). This will tell you if there are any tracks in `md_map.json` that don't match up with any GPM track.
3232-13. Disconnect from internet. This is because iTunes can pause step 11 by showing a popup message because we're changing the system's date and time.
3333-14. Run `python3 add_to_itunes`. Now we actually add the tracks to iTunes. It does this by setting the system's date and time to the GPM track's "date added", then adds it to iTunes and updates it's metadata. If there are tracks that already exist in iTunes, it will
3434-15. You can reconnect to the internet.
3535-16. Your system's date and time might be messed up. Open the System Preferences app, go to "Date & Time" and make sure everything is good. The "Set date and time automatically" option might have been turned off and not been turned back on again.
3636-17. Done!
2727+1. Preparations
2828+ 1. Run `python3 main.py match_files <songs_path>`. Replace `songs_path` with the path of the folder you downloaded your GPM library's song files into. This command will connect the files to the metadata.
2929+ 1. If you have tracks that exist in both iTunes and GPM, but have different titles, artists and/or albums, you can create an `md_map.json` file, which will make gpm-to-itunes match those songs together, so you won't end up with duplicates. If you think you may have made some mistakes, running `python3 check_md_map.py` can help spot some of them.
3030+ 1. If you have tracks in iTunes, run `python3 main.py scan_itunes` (Optional but recommended). It will tell you:
3131+ - When it finds tracks that already exist in your GPM library.
3232+ - When it finds duplicate tracks in iTunes (tracks with equal titles, artists and albums). If there are, a GPM track would match one of them randomly.
3333+ - When tracks in iTunes don't match up with any GPM track. To make these easier to add to `md_map.json`, they are logged in the format the file uses.
3434+1. Importing to iTunes
3535+ 1. Disconnect from internet. We'll be changing the system's date and time to preserve the "date added", and this causes iTunes to show popups that pause gpm-to-itunes.
3636+ 1. Run `python3 add_to_itunes` to add the tracks to iTunes. It will set the system's date and time to preserve the "date added", then adds it to iTunes and updates it's metadata.
3737+ 1. Reconnect to the internet.
3838+ 1. Open "Date & Time" in the System Preferences app, and make sure the date and time is right, and that the "Set date and time automatically" option is what you prefer (It's usually on).
3939+ 1. Done!
37403841# Running main.py
3942Run gpm-to-itunes using `python3 main.py [action] [songs_path]`.
···4952- `songs_path` is the path to the folder with your GPM songs, and you only need it when running with the `match_files` action.
5053If you don't provide an `action` or `songs_path`, then the `action` and `songs_path` fields from the `options.py` file will be used. This is especially useful if you want to use nodemon
51545252-# options.py
5353-File with options for when you run main.py.
5454-```python
5555-options = {
5656-5757- # Username and password for Google Play Music
5858- 'gpm_username': '<USERNAME>',
5959- 'gpm_password': '<PASSWORD>',
6060-6161- # The default action gpm-to-itunes will do (when
6262- # no CLI arguments are given). These are the possible values:
6363- # - download
6464- # - restructure
6565- # - match_files
6666- # - scan_itunes
6767- # - add_to_itunes
6868- 'action': 'download',
6969-7070- # The default path to your downloaded GPM library songs
7171- 'songs_path': '/Users/<USERNAME>/Downloads/mymusic',
7272-7373- # Your Mac user's password. Needed for changing your computer's date and time:
7474- 'sudo_password': '<PASSWORD>',
7575-}
7676-```
7777-# md_map.json
5555+# user_files/md_map.json
7856A file that you can use to map GPM tracks to it's iTunes equivalents. Use this if you have a GPM track that already exists in iTunes, but with a different title, artist or album. Example:
7957```
8058{
8181- "gpm_title - gpm_artist - Surface": {
5959+ "gpm_title - gpm_artist - gpm_album": {
8260 "title": "itunes_title",
8361 "artist": "itunes_artist",
8462 "album": "itunes_album"