more progress on apple music integration

This commit is contained in:
2023-11-16 20:59:31 +01:00
parent 142a835048
commit aa64d07570
4 changed files with 113 additions and 78 deletions

View File

@@ -22,17 +22,19 @@ createApp( {
computed: {
songQueue() {
let ret = [];
let pos = 0;
for ( let song in this.songs ) {
if ( parseInt( song ) >= this.queuePos ) {
if ( pos >= this.queuePos ) {
ret.push( this.songs[ song ] );
}
pos += 1;
}
return ret;
},
getTimeUntil() {
return ( song ) => {
let timeRemaining = 0;
for ( let i = this.queuePos; i < this.songs.length; i++ ) {
for ( let i = this.queuePos; i < Object.keys( this.songs ).length - 1; i++ ) {
if ( this.songs[ i ] == song ) {
break;
}
@@ -267,7 +269,7 @@ createApp( {
},
animateBeat () {
$( '.beat-manual' ).stop();
const duration = Math.ceil( 60 / this.playingSong.bpm * 500 ) - 50;
const duration = Math.ceil( 60 / ( this.playingSong.bpm ?? 180 ) * 500 ) - 50;
$( '.beat-manual' ).fadeIn( 50 );
setTimeout( () => {
$( '.beat-manual' ).fadeOut( duration );