Created
February 19, 2015 23:27
-
-
Save LukeXF/326c1ac2aebdb8dd7569 to your computer and use it in GitHub Desktop.
How I load the current song on my Twitch Stream
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
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> | |
<style type="text/css"> | |
body { | |
width: 305px; | |
overflow: hidden; | |
max-height: 30px; | |
height: 27px; | |
} | |
</style> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$.get("refresh.php", function (result) { | |
$('#latestData').html(result); | |
}); | |
setInterval(function() { | |
$.get("refresh.php", function (result) { | |
$('#latestData').html(result); | |
}); | |
}, 10000); | |
}); | |
</script> | |
<span id="latestData"></span> |
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
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> | |
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400' rel='stylesheet' type='text/css'> | |
<style type="text/css"> | |
* { | |
font-family: 'Lato', sans-serif; | |
color: white; | |
font-weight: 300; | |
} | |
</style> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
var firsttrack; | |
var counter = 0; | |
var flag = 1; | |
$.getJSON('http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=LukeBrown1509&api_key=0a93ef2200190981879654a7fa597639&format=json', | |
function(data) { | |
$.each(data.recenttracks.track, function(i, data) { | |
if (counter != flag) { | |
var artist = data.artist; | |
$("#display" ).html(data.name + " - "); | |
$("#display2").html(artist['#text']); | |
counter = flag; | |
} else { | |
return; | |
} | |
}); | |
}); | |
}); | |
</script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($lol){ | |
var firsttrack; | |
var counter = 0; | |
var flag = 1; | |
$lol.getJSON('http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=LukeBrown1509&api_key=0a93ef2200190981879654a7fa597639&format=json', | |
function(data){ | |
$lol.each(data.recenttracks.track, function(i,data){ | |
if(counter != flag){ | |
$lol("#display2").html(data.artist./#name); | |
counter = flag; | |
} else { | |
return; | |
} | |
}); | |
}); | |
}); | |
</script> | |
<div class="spotify-module"> | |
<span id="display"></span> | |
<span id="display2"></span> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment