[READ-ONLY] Mirror of https://github.com/probablykasper/gpm-to-itunes. Imports Google Play Music library to iTunes
cli google-play-music itunes
0

Configure Feed

Select the types of activity you want to include in your feed.

Better documentation

Kasper (Jan 7, 2019, 10:57 PM +0100) 950591e9 bce7fe11

+24 -46
+24 -46
README.md
··· 1 1 # gpm-to-itunes 2 2 Adds your GPM library to iTunes. 3 3 4 - 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. 4 + 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. 5 5 6 - 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. 6 + 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: 7 + - The iTunes file and "date added" will be kept 8 + - The play counts will be combined 9 + - The most recent "played date" will be used 10 + - 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. 7 11 8 12 In iTunes, a playlist folder named "GPM PLAYLISTS" will be created. GPM user playlists will be added into it. 9 13 10 - 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. 14 + 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. 11 15 12 16 # Guide 13 17 1. Setup ··· 17 21 1. Run `python3 -m pip install gmusicapi appscript mp3_tagger tqdm` to install some stuff gpm-to-itunes needs. 18 22 1. Create the `options.py` file. Follow the example shown below. 19 23 1. Download 20 - 1. Run `python3 main.py login` to log in to GPM. 21 - 1. Run `python3 main.py download`. This will download and save your GPM library's metadata to `library_downloaded.json`. 22 - 1. Run `python3 main.py restructure`. This just does some changes to `library_downloaded.json` and saves the new version as `library_restructured.json`. 24 + 1. Run `python3 main.py login` to log in to GPM. Instructions will be shown. 25 + 1. Run `python3 main.py fetch`. This downloads metadata from GPM and restructures it. 23 26 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. 24 - 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. 25 - 1. If you have tracks that exist in both iTunes and GPM 26 - 27 - 28 - 29 - 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. 30 - 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. 31 - 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. 32 - 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. 33 - 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 34 - 15. You can reconnect to the internet. 35 - 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. 36 - 17. Done! 27 + 1. Preparations 28 + 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. 29 + 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. 30 + 1. If you have tracks in iTunes, run `python3 main.py scan_itunes` (Optional but recommended). It will tell you: 31 + - When it finds tracks that already exist in your GPM library. 32 + - 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. 33 + - 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. 34 + 1. Importing to iTunes 35 + 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. 36 + 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. 37 + 1. Reconnect to the internet. 38 + 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). 39 + 1. Done! 37 40 38 41 # Running main.py 39 42 Run gpm-to-itunes using `python3 main.py [action] [songs_path]`. ··· 49 52 - `songs_path` is the path to the folder with your GPM songs, and you only need it when running with the `match_files` action. 50 53 If 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 51 54 52 - # options.py 53 - File with options for when you run main.py. 54 - ```python 55 - options = { 56 - 57 - # Username and password for Google Play Music 58 - 'gpm_username': '<USERNAME>', 59 - 'gpm_password': '<PASSWORD>', 60 - 61 - # The default action gpm-to-itunes will do (when 62 - # no CLI arguments are given). These are the possible values: 63 - # - download 64 - # - restructure 65 - # - match_files 66 - # - scan_itunes 67 - # - add_to_itunes 68 - 'action': 'download', 69 - 70 - # The default path to your downloaded GPM library songs 71 - 'songs_path': '/Users/<USERNAME>/Downloads/mymusic', 72 - 73 - # Your Mac user's password. Needed for changing your computer's date and time: 74 - 'sudo_password': '<PASSWORD>', 75 - } 76 - ``` 77 - # md_map.json 55 + # user_files/md_map.json 78 56 A 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: 79 57 ``` 80 58 { 81 - "gpm_title - gpm_artist - Surface": { 59 + "gpm_title - gpm_artist - gpm_album": { 82 60 "title": "itunes_title", 83 61 "artist": "itunes_artist", 84 62 "album": "itunes_album"