Created
April 10, 2013 20:58
-
-
Save egid/5358387 to your computer and use it in GitHub Desktop.
Just a proof of concept to see if I could semi-quickly check to see what the current KEXP track was. The plan is to dig into how Alfred extensions work and see if I can make use of this. It currently can only parse the contents of [the KEXP.org mini playlist](http://kexp.org/playlist/miniplaylist).
This file contains 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
var getLiveTrack = function() { | |
// inefficiently get contents of first playlist element | |
var live = JSON.parse(document.getElementById('PlaylistItems').children[0].getAttribute('data-playlistitem').toString()) | |
// inefficiently output results | |
if (live.ArtistName && live.TrackName) { | |
console.log(live.ArtistName + ' - ' + live.TrackName); | |
} else if (live.ArtistName) { | |
console.log(live.ArtistName + ' - unknown track'); | |
} else if (live.TrackName) { | |
// i'm not sure how this would happen, but stranger things have occurred | |
console.log('Unknown Artist - ' + live.TrackName); | |
} else { | |
console.log('air break'); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment