add backend for feeding information to main ui

This commit is contained in:
janis
2023-11-20 10:09:03 +01:00
parent bfde5cd0ac
commit dec311cb73
2 changed files with 30 additions and 10 deletions

View File

@@ -88,6 +88,17 @@ const app = Vue.createApp( {
setTimeout( () => {
this.sendUpdate( 'pos' );
}, 500 );
const minuteCounts = Math.floor( ( this.playingSong.duration ) / 60 );
this.durationBeautified = String( minuteCounts ) + ':';
if ( ( '' + minuteCounts ).length === 1 ) {
this.durationBeautified = '0' + minuteCounts + ':';
}
const secondCounts = Math.floor( ( this.playingSong.duration ) - minuteCounts * 60 );
if ( ( '' + secondCounts ).length === 1 ) {
this.durationBeautified += '0' + secondCounts;
} else {
this.durationBeautified += secondCounts;
}
}
} );
this.apiGetRequest( 'https://api.music.apple.com/v1/me/library/playlists', this.playlistHandler );
@@ -405,6 +416,9 @@ const app = Vue.createApp( {
console.log( err );
} );
},
toggleShowMode() {
this.isShowingRemainingTime = !this.isShowingRemainingTime;
}
},
watch: {
pos() {