Created
November 29, 2011 18:05
-
-
Save imajes/1405748 to your computer and use it in GitHub Desktop.
fluid user script for turntable.fm to alert growl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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