Skip to content

Instantly share code, notes, and snippets.

@imajes
Created November 29, 2011 18:05
Show Gist options
  • Select an option

  • Save imajes/1405748 to your computer and use it in GitHub Desktop.

Select an option

Save imajes/1405748 to your computer and use it in GitHub Desktop.
fluid user script for turntable.fm to alert growl
function setNP(str) {
window.nowPlaying = str;
}
function nowPlaying() {
return window.nowPlaying;
}
setTimeout(updateGrowl, 1000);
setInterval(updateGrowl, 5000);
setNP("");
function updateGrowl() {
track = $("div.messages").find("div.message").last().find("span.text").text();
if (track == nowPlaying()) {
return;
}
else if (track.match(/^ started playing/)) {
fluid.showGrowlNotification({
title: "Turntable",
description: track.slice(17, track.length),
priority: 2,
sticky: false
});
setNP(track);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment