Skip to content

Instantly share code, notes, and snippets.

@egid
Created April 10, 2013 20:58
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 egid/5358387 to your computer and use it in GitHub Desktop.
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).
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