Thursday, April 08, 2010

Combo station urls

In this blog post I'll tell you how to create Last.fm combo station urls. Last.fm station urls always start with "lastfm://". For combo station urls, an example might look like
lastfm://rql/dGFnOnBvcCBub3Qgc2ltYXJ0OiJMYWR5IEdhZ2Ei
See that long character string after rql/ ? That is just simple Base64 encoding and RQL means "Radio Query Language". If you'd use a decoder like this one,it will decode to
tag:pop not simart:"Lady Gaga"
So, there are key-value pairs and logical connectors (valid ones are 'and', 'or' and 'not'). The above query means "play everything in direction of 'pop' tag, but not Lady Gaga's similiar artists". I think you got the idea...
The point I did not mention yet is that there are some nice options available. Let's change our query a bit:
tag:pop not simart:"Lady Gaga" opt:mainstr|0.55 opt:rep|0.6 opt:discovery|true
Huh? Lots of opt(ions)! mainstr stands for "Maintream", where the value range is from 0-1(0% to 100%). The less the value, the more unknown artists will occur in your station. Same goes for rep(etition), but in this case you can control the artist(or track?) repetition rate. I think "discovery" is kind of self-explanatory(discovery mode on/off). Here you got a nice table with names, values and descriptions:
NameValueDescription
user[username]personal station
library[username]a users library
loved[username]loved tracks of user. After Nov 17 2010 this station is not available anymore!
rec[username]recommendations for a user
neigh[username]neighbour radio of user
ptag[tag of user]|[username]Personal tag radio of a user. The '|' is NO or!. After Nov 17 2010 this station is not available anymore!
playlist[playlist-id]A playlist station. Use user.getPlaylist API call to get playlist id's of a user's playlist. After Nov 17 2010 this station is not available anymore!
adv[username]Play a user's mix radio.
simart"[artist name]"Similiar artists of an artist. Keep the quotes around.
tag[tag]Global tag radio
group"Group Name" or [groupid]Group radio
opt:rep|[0-1](default: 0.5)Specifies the track repetition, means how long it will take until the track is played again
opt:mainstr|[0-1] (default: 0.5)Type of tracks played(obscure to popular)
opt:discovery|[true|false] (default: false)Discovery mode on/off
Note that the options are all optional and thus have a default value. Connect name and value with a ':', except for the opt: values. If a value contains a space, it must be enclosed with double-quotes(""). Known Issues
  • Discovery mode is subscribers only.
  • In the Base64 RFC specification there is a space after 76 characters in the encoded string. Apparently the web and the desktop client cannot handle this space, so you have to remove it and everything will work fine.
Have fun with constructing the urls and implementing it in your app!
Very much thanks to Norman (nova77LF)(glorious creator of the Radio Query Language) for clarification on some points :)

4 comments:

norman said...

Hey Burny, excellent post! I am the creator of RQL so I have a few remarks to make:

1. RQL stands for Radio Query Language, not RDF. It's a completely made up language (and I love to create new languages! ;) ).

2. opt:rep specifies the repetition rate of tracks (and partially artist). This roughly is meant to let the user choose how much time should pass after you listen the same track again.

3. All entries (tags/users/artist) **with spaces** must be enclosed by quotes ("") or the parser will get confused. If they don't have spaces you can just put the name.

4. Mainstreamness is computed at track level and it's based on the starting pool of tracks. If your pool is limited no matter what you do you will get what's there (i.e. only popular songs for tag "famous song" even with obscurity=1).

Finally a plea: this is still on a very alpha stage. You can play with it but don't abuse it or I will have kill you. ;)

Cheers,
Norman

http://www.last.fm/user/nova77LF

Vee Eee Technologies said...

Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
Vee Eee Technologies

SHYAM said...

Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u


пользовательские

Hariharakumar Bandaru said...

If you are interested in migrating your blog from blogger to wordpress then you can contact us. We are providing free blogger to wordpress migration service for bloggers. For more details see this link Geek's Page Services.