Created
February 21, 2015 16:23
-
-
Save agarrharr/7f3a902613e5ce5b9832 to your computer and use it in GitHub Desktop.
Pianobar Widget Using Firebase
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
<div class="widget"> | |
<h3>Currently Listening To</h3> | |
<div id="pianobar"> | |
<div id="pianobarSong"></div> | |
<div id="pianobarArtist"></div> | |
<div id="pianobarAlbum"></div> | |
</div> | |
</div> | |
<script> | |
var ref = new Firebase("https://blazing-fire-5020.firebaseio.com/currentSong"); | |
ref.on("value", function(snapshot) { | |
$('#pianobarSong').text(snapshot.val().title); | |
$('#pianobarArtist').text(snapshot.val().artist); | |
$('#pianobarAlbum').text(snapshot.val().album); | |
}, function (errorObject) { | |
console.warn("The read from firebase failed: " + errorObject.code); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment