Skip to content

Instantly share code, notes, and snippets.

@spejman
Created December 29, 2009 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spejman/265292 to your computer and use it in GitHub Desktop.
Save spejman/265292 to your computer and use it in GitHub Desktop.
Ubiquity 0.5 command for seaching in Spotify
// Based on http://anders.mellbratt.se/lastspot.html Thanks to Anders Mellbratt
CmdUtils.CreateCommand({
names: ['spotify search'],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'music seach'}],
icon: "http://www.spotify.com/favicon.ico",
description: "Performs a search in Spotify",
author: {name: "Sergio Espeja", email: "sergio.espeja@gmail.com"},
homepage: "http://sergioespeja.com",
preview: function( pblock, args ) {
pblock.innerHTML = "Do a spotify search for: <i>" + args.object.text + "</i>";
},
execute: function(args) {
Utils.openUrlInBrowser("spotify:search:" + args.object.text);
var tabName = args.object.text;
var tab = Utils.tabs.get("spotify:search:" + args.object.text);
if (tabName && tab) {
tab.close();
}
else {
Application.activeWindow.activeTab.close();
}
displayMessage(tabName + " tab closed");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment