Skip to content

Instantly share code, notes, and snippets.

@ba3r
Forked from anonymous/x
Created August 3, 2009 21:50
Show Gist options
  • Save ba3r/160846 to your computer and use it in GitHub Desktop.
Save ba3r/160846 to your computer and use it in GitHub Desktop.
last.fm radio starter
CmdUtils.CreateCommand({
names: ["radio", "last.fm radio"],
icon: "http://cdn.last.fm/flatness/nice_favicon.png",
homepage: "www.last.fm",
author: {name: "Michael Baer", homepage: "http://twitter.com/synapsos"},
license: "GPL",
description: "Last.FM radio starter - works with 0.5+ (Parser 2)",
help: "Type radio followed by the artist you want to listen to.",
arguments: [{role: 'object', nountype: noun_arb_text, label: "artist name"}],
preview: function(pblock, args) {
pblock.innerHTML = "Start radio for: <b>" + args.object.text + "</b> and similar artists";
},
execute: function(args) {
var input = args.object.text ;
var output = input.replace(/\s+/g,"%20");
displayMessage("Starting " + args.object.text + " radio. Enjoy!");
Utils.openUrlInBrowser( "http://www.last.fm/listen/artist/" + output + "/similarartists" );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment