music update
All checks were successful
Build and push container image / build-and-push-image (push) Successful in 4m39s
All checks were successful
Build and push container image / build-and-push-image (push) Successful in 4m39s
This commit is contained in:
@@ -90,29 +90,21 @@ document.addEventListener('keydown', function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
// Spotify API
|
||||
// Spotify API (now lastfm)
|
||||
|
||||
function getSpotify() {
|
||||
fetch('https://api.alfieking.dev/spotify/nowplaying/xz02oolstlvwxqu1pfcua9exz').then(response => {
|
||||
fetch('/lastfm/info').then(response => {
|
||||
return response.json();
|
||||
}).then(data => {
|
||||
if (data.item == null) {
|
||||
document.getElementById('spotify').style.backgroundImage = "none";
|
||||
document.getElementById('spotify-title').innerHTML = "Spotify is not playing anything";
|
||||
document.getElementById('spotify-artist').innerHTML = ":(";
|
||||
document.getElementById('spotify-link').href = "https://open.spotify.com/";
|
||||
return;
|
||||
}
|
||||
document.getElementById('spotify').style.backgroundImage = "url(" + data.item.album.images[0].url + ")";
|
||||
document.getElementById('spotify-title').innerHTML = data.item.name;
|
||||
document.getElementById('spotify-artist').innerHTML = data.item.artists[0].name;
|
||||
document.getElementById('spotify-link').href = data.item.external_urls.spotify;
|
||||
document.getElementById('spotify').style.backgroundImage = "url(" + data.image + ")";
|
||||
document.getElementById('spotify-title').innerHTML = data.track;
|
||||
document.getElementById('spotify-artist').innerHTML = data.artist;
|
||||
});
|
||||
}
|
||||
|
||||
if (document.getElementById('spotify')) {
|
||||
getSpotify();
|
||||
setInterval(getSpotify, 15000);
|
||||
setInterval(getSpotify, 60000);
|
||||
}
|
||||
|
||||
// load buttons
|
||||
|
||||
Reference in New Issue
Block a user