adhtgf
This commit is contained in:
parent
791cd5254c
commit
630e63588e
2 changed files with 28 additions and 48 deletions
50
index.html
50
index.html
|
@ -114,7 +114,6 @@
|
|||
<script src="https://unpkg.com/butterchurn/lib/butterchurn.min.js"></script>
|
||||
<script src="https://unpkg.com/butterchurn-presets/lib/butterchurnPresets.min.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
|
||||
<script>
|
||||
let username = localStorage.getItem('lastfmUsername') || 'yetiuard';
|
||||
const url = `https://lastfm-last-played.biancarosa.com.br/${username}/latest-song`;
|
||||
|
@ -187,41 +186,22 @@
|
|||
document.getElementById('favicon').href = newIcon;
|
||||
});
|
||||
});
|
||||
|
||||
// New onTrackDidChange functionality
|
||||
const unsubscribe = webamp.onTrackDidChange((trackInfo) => {
|
||||
if (trackInfo && trackInfo.metaData) {
|
||||
const { title = "Unknown Title", artist = "Unknown Artist" } = trackInfo.metaData;
|
||||
console.log("New track playing:", { title, artist });
|
||||
} else if (trackInfo) {
|
||||
console.log("New track URL:", trackInfo.url);
|
||||
} else {
|
||||
console.log("No track is currently playing.");
|
||||
}
|
||||
});
|
||||
|
||||
// Example: Unsubscribe when no longer needed
|
||||
// unsubscribe();
|
||||
</script>
|
||||
<script>
|
||||
let currentSong = {
|
||||
title: '',
|
||||
artist: ''
|
||||
};
|
||||
|
||||
// Update currentSong with the track details every time the track changes
|
||||
webamp.onTrackDidChange((trackInfo) => {
|
||||
if (trackInfo) {
|
||||
currentSong = {
|
||||
title: trackInfo.metaData.title || '',
|
||||
artist: trackInfo.metaData.artist || ''
|
||||
};
|
||||
console.log('Currently playing:', currentSong);
|
||||
} else {
|
||||
// If no track is playing, set the song to empty values
|
||||
currentSong = {
|
||||
title: '',
|
||||
artist: ''
|
||||
};
|
||||
console.log('No track is currently playing');
|
||||
}
|
||||
});
|
||||
|
||||
// You can check the current song at any time
|
||||
function getCurrentSong() {
|
||||
return currentSong;
|
||||
}
|
||||
|
||||
// Example of how you can get the current song manually:
|
||||
setInterval(() => {
|
||||
console.log('Current Song:', getCurrentSong());
|
||||
}, 5000); // Logs the current song every 5 seconds
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
12
index.js
12
index.js
|
@ -1497,21 +1497,21 @@ const webamp = new Webamp({
|
|||
"artist": "OutKast",
|
||||
"title": "So Fresh, So Clean"
|
||||
},
|
||||
"url": "https://8.prigoana.lol/OutKast - So Fresh, So Clean.flac"
|
||||
"url": "https://8.prigoana.lol/Outkast - So Fresh, So Clean.flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
"artist": "OutKast",
|
||||
"title": "Spaghetti Junction"
|
||||
},
|
||||
"url": "https://8.prigoana.lol/OutKast - Spaghetti Junction.flac"
|
||||
"url": "https://8.prigoana.lol/Outkast - Spaghetti Junction.flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
"artist": "OutKast with Khujo Goodie",
|
||||
"title": "Gasoline Dreams"
|
||||
},
|
||||
"url": "https://8.prigoana.lol/OutKast with Khujo Goodie - Gasoline Dreams.flac"
|
||||
"url": "https://8.prigoana.lol/Outkast with Khujo Goodie - Gasoline Dreams.flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
|
@ -1623,14 +1623,14 @@ const webamp = new Webamp({
|
|||
"artist": "OutKast",
|
||||
"title": "B.O.B. (Bombs Over Baghdad)"
|
||||
},
|
||||
"url": "https://9.prigoana.lol/OutKast - B.O.B. (Bombs Over Baghdad).flac"
|
||||
"url": "https://9.prigoana.lol/Outkast - B.O.B. (Bombs Over Baghdad).flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
"artist": "OutKast",
|
||||
"title": "Xplosion"
|
||||
},
|
||||
"url": "https://9.prigoana.lol/OutKast - Xplosion.flac"
|
||||
"url": "https://9.prigoana.lol/OutKast-%20Xplosion.flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
|
@ -1651,7 +1651,7 @@ const webamp = new Webamp({
|
|||
"artist": "OutKast",
|
||||
"title": "ATLiens"
|
||||
},
|
||||
"url": "https://9.prigoana.lol/OutKast - ATLiens.flac"
|
||||
"url": "https://9.prigoana.lol/OutKast- ATLiens.flac"
|
||||
},
|
||||
{
|
||||
"metaData": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue