A small tool for copying your playlists across music streaming services. Think rsync
, but for playlists.
The basic usage pattern is always drum cp [source] [destination]
where source
and destination
may be any of the following (internally called a ref):
- A file or folder, e.g.
.
some/folder
some-file.yaml
- A URI, e.g.
https://open.spotify.com/playlist/123456
spotify:playlist:123456
https://music.apple.com/us/playlist/some-name/pl.123456789
file:https:///path/to/list.yaml
- A special token, e.g.
@spotify/playlists
@spotify/tracks
@applemusic/playlists
@music/playlists
(referring to the local Apple Music (Music.app
) library on macOS)@stdin
@stdout
- A dash
-
, synonymous with@stdin
and@stdout
, depending on usage
Note
If the source is folder-like, i.e. includes multiple playlists, the destination has to be folder-like too. (The reverse is not true though.)
Download a playlist from Spotify.
drum cp https://open.spotify.com/playlist/123456 my-fancy-list.yaml
drum cp spotify:playlist:123456 my-fancy-list.yaml
drum cp spotify:playlist:123456 some/folder
Download your liked songs playlist from Spotify.
drum cp @spotify/tracks liked.yaml
Download all playlists from your Spotify library.
drum cp @spotify/playlists .
Upload a playlist to Spotify.
drum cp my-fancy-list.yaml @spotify/playlists
Currently, the following music services are supported:
- Spotify
- Apple Music
- Local, YAML-based playlists (via stdio or files)
Note
The tool only processes metadata, not the actual audio files.
After checking out the repo, run bin/setup
(or bundle install
) to install dependencies.
To run the application, run bundle exec bin/drum
. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Important
You may need to run bundle exec ruby bin/drum
on Windows
To package the application into a gem, run bundle exec rake build
. The built gem should then be located in pkg
.
Important
If you wish to install drum
using gem install
, you may need to install additional gems such as rb-scpt
on macOS to use platform-specific integrations. See the Gemfile
for more information.
To install the gem, run bundle exec rake install
.
To generate the documentation, run bundle exec rake yard
.
To run tests, run bundle exec rake spec
.
Tip
If you wish to use a language server such as Solargraph and code completion isn't working for required gems, you may have to run yard gems
: https://solargraph.org/guides/troubleshooting
To use the service integration with Spotify, set the following environment variables:
SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_SECRET=...
The client ID and secret can be obtained by creating a Spotify application in the developer dashboard. After adding the application, make sure to whitelist the following redirect URI (required for user authentication):
https://localhost:17998/callback
To use the service integration with Apple Music, set the following environment variables:
MUSICKIT_KEY_P8_FILE_PATH=...
MUSICKIT_KEY_ID=...
MUSICKIT_TEAM_ID=...
This keys can be obtained as described here (requires an Apple Developer Program membership).
- The Spotify API does not support folders
- The Apple Music API does support folders, these are not implemented yet, however (see this issue)
Bug reports and pull requests are welcome on GitHub at https://github.com/fwcd/drum.
The gem is available as open source under the terms of the MIT License.