I use Rdio a lot and I saw a lot of playlists like "iTunes Top 100" or anything related to iTunes, where people put this stuff in manually. Why not just automate this process?
Playlists using this script
- iTunes Top 100 (US)
- iTunes Top 100 - Hip-Hop/Rap (US)
- iTunes Top 100 - Pop (US)
- iTunes Top 100 - Alternative (US)
- iTunes Top 100 - Rock (US)
Currently, one of my personal servers keeps this in sync. You're free to adopt this script on your own systems. If you want me to maintain a list that isn't listed here, feel free to message me!
How to use
You need to edit config.php.sample to include your Rdio Developer Key:
Edit the invoke script
invoke.phpwith the proper Rdio Playlist IDs and iTunes URLs.
- You must already have created the playlist.
You can find iTunes RSS feeds here:
You can then execute the invoke script by:
Or you can run the script as a one time use:
php itunes-to-rdio.php <Rdio Playlist ID> <iTunes RSS URL>
Example iTunes URL:
Example Rdio Playlist URL:
Note from the above URL, that
294061 is the ID that the script requires.
How it works
Actually, its a pretty simple script. I'll explain below. For now, this will serve as a design specification.
We want to ask the user for two things, the iTunes URL and the Rdio Playlist name
It takes in a URL from iTunes web service such as:
- Because the above data is in JSON, we take the data and put into a associative array, where we can easily iterate through this data.
- From there, we ask the Rdio API for the current Rdio playlist. Because the Rdio playlists are social, we don't want to remove it because we still want the subscribers there. Instead, we will remove every song from the list.
- After removing the songs and preserving the playlist, we will now take our iTunes associative array, search for the songs on Rdio and then place it into the playlist.