Project for Linux which exports Spotify playlists to classical .m3u playlists
- Amarok
- spotify-export
This How-To is loosely based on my blog post at http://blog.wasmitnetzen.de/?p=192 (in german) which describes the usage as of May 2013.
You can divide this process into two main parts: first to export the metadata of each song from Spotify and as a second step to build classical .m3u playlists from the data.
As you'll probably not possess all your songs you have in a Spotify playlist as a mp3, you'll get a list of missing files at the end. (Unfortunately, this list is not very nicely formatted at the moment as I am not very good with QtScript. Any input on this is appreciated.)
- cd
- Clone this repo:
git clone git://github.com/wasmitnetzen/spotibye.git
cd spotibye
- I am using spotify-export to make requests to the Spotify API to get the metadata from Spotify. It is embedded as a submodule.
- Fetch spotify-export:
git submodule init && git submodule update
sudo apt-get install ruby1.9.1-de sqlite3-doc libsqlite3-dev
sudo gem install ruby-progressbar sqlite3 activerecord bundler
- Follow the instructions https://github.com/jlund/spotify-export/blob/master/README.md. I named the file pl_spot.txt.
- Open Spotify and go to the playlist that you want to export
- Select the tracks that you want to export (Ctrl-A or Cmd-A to Select All)
- Right-click on the selected tracks and choose "Copy Spotify URI" from the menu
- Run spotibye.sh:
./spotibye.sh
- Paste the copied urls into the text editor and save the file. (If its Nano: Ctrl+O, Ctrl+X).
- The script queries the Spotify database for the metadata. In the file
pl_ta.txt
we have now the format
Title -- Artist -- Album
To use these files I wrote a QTScript for Amarok. It takes the metadata from the files, searches (very fuzzily) for a corresponding song and adds the results to the current playlist. As a result from the fuzzy search, songs with multiple version might get added multiple times, so there's probably still some manual work necessary. As I am not very good with QTScript, we'll need to set some variables manually.
In order to get Amarok to use the script, link the file to the correct location and edit the file afterwards:
cd ~/.kde/share/apps/amarok/scripts/
(the folder may not exist)ln -s ~/spotibye/amarok-spotibye AmarokSpotibye
nano ~/.kde/share/apps/amarok/scripts/AmarokSpotibye/main.js
playlist
needs to be set, usually you just need to replace $USER with your username:
var playlist = "/home/$USER/spotibye/pl_ta.txt";
Finally we can start Amarok. Wait for Amarok to fully index your music, then empty the current playlist (on the right side) as it will be filled by the script and start the script.
- Settings -> Configure Amarok -> Scripts -> activate "Amarok-Spotibye" and "Amarok Script Console"
Amarok.runScript("AmarokSpotibye");
Now the playlist can be saved by clicking on the disk symbol on the bottom. The playlist manager will open on the right side where the playlist can be exported with a right click.