Git Product home page Git Product logo

drum's Introduction

Drum

Test Documentation

A small tool for copying your playlists across music streaming services. Think rsync, but for playlists.

Icon

Usage

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:///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.)

Examples

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

Supported Services

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.

Development

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

Spotify

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):

http://localhost:17998/callback

Apple Music

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).

Limitations

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fwcd/drum.

License

The gem is available as open source under the terms of the MIT License.

drum's People

Contributors

fwcd avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

drum's Issues

Add support for song-mapping with local audio files

Currently, songs are only stored by their metadata and e.g. their Spotify ID. It would be nice, however, to be able to map them to actual audio files if the user has the corresponding song locally on their computer (e.g. by providing drum a folder where music is stored).

This matching should ideally be fuzzy (work with a variety of formats, including MP3 tags or when only title and artist are stored in some combination in the title).

Once mapped, the local audio file path should be stored in the track, similar to how Spotify and Apple Music IDs are stored currently.

Local audio file mappings would also let us properly handle services that rely on local paths such as

Implement song matching across streaming services

E.g. by ISRC to uniquely identify songs.

One approach would be to automatically match tracks whenever the DB changes across all streaming services, this would potentially be very API-heavy, however, since every configured streaming service would have to be consulted upon every track change.

Another approach would be to match on-demand e.g. when a user tries to push a playlist to Apple Music that only has associated Spotify ids.

Add support for smart playlists

Add support for 'smart' playlists, i.e. saved queries that carry a list of (possibly hierarchial) rules, combined using logical operators (AND, OR, ...).

Being able to sync these with services, even if those have no notion of 'smart' playlists, would be nice too.

Batch-query audio features from Spotify

With RSpotify::AudioFeatures::find we can fetch audio features for up to 100 tracks at once, thereby making it possible to query them efficiently without spamming the API.

Add support for local Mixxx database

Integrate with the Mixxx database and in particular make it possible to export/import playlists both as playlists and crates. Since the Mixxx database seems to be a standard SQLite database, this shouldn't be too hard to do, but would probably benefit from having #20 implemented already.

Add lightweight web frontend

Add a minimal web frontend for browsing and managing the local database using webrick. To launch the server, a new command like web could be added.

Add support for Spotify

Integrate support for the Spotify API using rspotify. This includes:

  • Adding the API and implementing authentication (both app-level and OAuth)
  • Implementing download
  • Implementing upload

Add more fine-grained pulling/pushing

Support playlist-level pushing/pulling and add a confirmation prompt when the user attempts to push the entire library at once.

E.g. support pulling Playlist-URLs/IDs from Spotify

Add support for ISRC-based song matching

Both Spotify and Apple Music seem to provide ISRCs for songs, so it would be nice to also perform song matching with them instead of the currently used search-based (possibly imprecise) matching.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.