Skip to content

Commit

Permalink
Remove all code relating to Google Play Music
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Feb 2, 2021
1 parent ccc9fe6 commit d2653fa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 212 deletions.
148 changes: 0 additions & 148 deletions GoogleMusic.py

This file was deleted.

27 changes: 0 additions & 27 deletions GoogleMusicManager.py

This file was deleted.

36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Transfer a Spotify Playlist to Google Play Music
# Transfer a Spotify Playlist to YouTube Music

A simple command line script to clone a Spotify playlist to Google Play Music.
A simple command line script to clone a Spotify playlist to YouTube Music.

- Transfer a single Spotify playlist
- Transfer all playlists for a Spotify user

Also includes interfaces to:

- Create a Play Music playlist from a text file
- Upload local MP3s to Play Music

**New:** YouTube Music support. Spotify playlists can now be transferred to YouTube Music thanks to [ytmusicapi](https://github.com/sigma67/ytmusicapi).
Usage is identical to GoogleMusic.py, just use `python YouTube.py` with the same parameters.
- Create a YouTube Music playlist from a text file

## Requirements

Expand All @@ -32,43 +28,35 @@ $ cp settings.ini.example settings.ini

3. Fill in your `client_id` and `client_secret` from your Spotify app

4. For Google Play Music, open a console in the source code folder and run

`python Setup.py <client>`
4. For YouTube Music, open a console in the source code folder and run

where `<client>` should be `mobileclient` to setup playlist transfers **or** `musicmanager` to be able to upload files with GoogleMusicManager.py.
For YouTube Music setup, use `youtube`.
`python Setup.py youtube`

Then, follow the command line instructions to grant this app access to your account. All credentials are stored locally in the file `settings.ini`.

## Transfer a playlist

After you've created the settings file, you can simply run the script from the command line using:

`python GoogleMusic.py <spotifylink>`
`python YouTube.py <spotifylink>`

where `<spotifylink>` is a link like https://open.spotify.com/user/edmsauce/playlist/3yGp845Tz2duWCORALQHFO
Alternatively you can also **use a file name** in place of a spotify link. The file should contain one song per line.

The script will log its progress and output songs that were not found in Google Play Music to **noresults.txt**.
The script will log its progress and output songs that were not found in YouTube Music to **noresults.txt**.

## Transfer all playlists of a Spotify user

For migration purposes, it is possible to transfer all public playlists of a user by using the Spotify user's ID (unique username).

`python GoogleMusic.py --all <spotifyuserid>`

## Upload songs

To upload songs, run
`python YouTube.py --all <spotifyuserid>`

`python GoogleMusicManager.py <filepath>`

## Command line options

There are some additional command line options for setting the playlist name and determining whether it's public or not. To view them, run

`> python GoogleMusic.py -h`
`> python YouTube.py -h`

Arguments:

Expand All @@ -80,12 +68,12 @@ positional arguments:
optional arguments:
-h, --help show this help message and exit
-u UPDATE, --update UPDATE
Delete all entries in the provided Google Play Music
Delete all entries in the provided YouTube Music
playlist and update the playlist with entries from the
Spotify playlist.
-n NAME, --name NAME Provide a name for the Google Play Music playlist.
-n NAME, --name NAME Provide a name for the YouTube Music playlist.
Default: Spotify playlist name
-i INFO, --info INFO Provide description information for the Google Play
-i INFO, --info INFO Provide description information for the YouTube
Music Playlist. Default: Spotify playlist description
-d, --date Append the current date to the playlist name
-p, --public Make the playlist public. Default: private
Expand Down
10 changes: 1 addition & 9 deletions Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
import settings

if __name__ == "__main__":
if sys.argv[1] == "mobileclient":
from gmusicapi import Mobileclient
api = Mobileclient(debug_logging=True)
settings['google']['mobileclient'] = api.perform_oauth(open_browser=True).to_json()
elif sys.argv[1] == "musicmanager":
from gmusicapi import Musicmanager
api = Musicmanager(debug_logging=True)
settings['google']['musicmanager'] = api.perform_oauth(open_browser=True).to_json()
elif sys.argv[1] == "youtube":
if sys.argv[1] == "youtube":
from ytmusicapi import YTMusic
api = YTMusic()
settings['youtube']['headers'] = api.setup()
Expand Down
3 changes: 1 addition & 2 deletions requirements
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
gmusicapi
ytmusicapi>=0.12.2
ytmusicapi
spotipy
2 changes: 0 additions & 2 deletions settings.ini.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[google]

[youtube]
headers = headers_json_from_browser
user_id =
Expand Down

0 comments on commit d2653fa

Please sign in to comment.