sync_songs
With sync_songs you can sync sets of songs between services. If you have one set of song at one service and another song set at another service you can use sync_songs to merge the song sets. sync_songs can also be used to backup song sets by the ability to spread them across several services. Additionaly sync_songs can be used to diff song sets.
Currently sync_songs supports the following services:
- csv (on the form
name, artist, album, duration, id
where only the first two fields are required) - Grooveshark
- Last.fm
For details see services.org.
sync_songs can be used as standalone but also as a library.
Installation
To use sync_songs one has to have Ruby installed. The easiest way to install Ruby is to use a package management system. If you are on a Debian-based distribution you can issue the following terminal command to install Ruby:
sudo apt-get install ruby1.9.1
The following describes three ways of obtaining and installing. The first way is recommended for users and the second way is recommended for developers.
Gem
This is the best method to install for most purposes. It requires RubyGems which on Debian-based distributions can be installed via the following command:
sudo apt-get install rubygems1.9.1
Then you can install sync_songs and its dependencies via the following command:
sudo gem install sync_songs
Git
This method is good if you want to help develop sync_songs. It requires Git which on Debian-based distributions can be installed via the following command:
sudo apt-get install git
To get the dependencies for sync_songs one can use bundler which can be installed via RubyGems (see above for installation instructions) in the following way:
sudo gem install bundler
To install sync_songs cd
to an empty directory and do
git clone https://github.com/Sleft/sync_songs.git .
to clone the git repository into that directory. You can use the same command when you want to update it. To install the dependencies issue the following the same directory:
bundle
Archive
This method is not recommended but good if you for some reason cannot use RubyGems or Git. Download an archive and extract to the directory you want to install in. Install the dependencies listed in the gemspec.
Usage
If you want to use sync_songs simply to sync songs between different services you probably want to use it as standalone.
Standalone
Issue the following command to learn about how to use sync_songs:
sync_songs help
The most common way of using sync_songs is probably to sync between two services by issuing a command of the following form:
sync_songs sync --color -vs user1:service1:favorites user2:service2:favorites
The --color
option is recommended as it contributes to legibility. The -v
option is recommended as it explains what is being done. Note that fetching song data from services may take some time due to limitations of bandwidth and due to limitations of particular services.
The above example does not work as it uses placeholder services. For a list of supported services one can issue
sync_songs supp
If one has a user named mary at Grooveshark and a user named smith at Last.fm one can use the following to sync between them:
sync_songs sync --color -vs mary:grooveshark:favorites smith:lastfm:loved
For usage notes on the supported services see services.org.
To sync between more than two services just add additional services as arguments to the -s
option. For example, to also sync to a csv file one can add it as an argument:
sync_songs sync --color -vs user1:service1:favorites user2:service2:favorites file_path:csv:library
Note that syncing to a csv is a way of backing up songs from services.
To diff songs one can proceed as above but by replacing the sync
command with diff
, e.g.
sync_songs diff --color -vs user1:service1:favorites user2:service2:favorites
Library
If you want to integrate sync_songs in a project add the following line to the project’s gemspec:
gem.add_runtime_dependency 'sync_songs'
Alternatively add the following line to your Gemfile:
gem 'sync_songs'
Now you should be able to require sync_songs
.
Note that you can use bundler to get dependencies for sync_songs, see installation via Git above.
License
See LICENSE.org.
Contributing and development
See CONTRIBUTING.org.