From 1d714da494ac8aec170af9e51026b773e7ec0fac Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Thu, 20 Nov 2025 16:38:31 +0100 Subject: [PATCH] Player: Improve custom song loading song data resolution --- MusicPlayerV2-GUI/src/components/playerView.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/MusicPlayerV2-GUI/src/components/playerView.vue b/MusicPlayerV2-GUI/src/components/playerView.vue index 8cad60e..0e405a5 100644 --- a/MusicPlayerV2-GUI/src/components/playerView.vue +++ b/MusicPlayerV2-GUI/src/components/playerView.vue @@ -431,8 +431,13 @@ parseBlob( blob ) .then( data => { try { - player.findSongOnAppleMusic( data.common.title - ?? songDetails.filename.split( '.' )[ 0 ] ) + const searchTerm = data.common.title + ? data.common.title + ' ' + data.common.artist + : songDetails.filename.split( '.' )[ 0 ]; + + console.debug( 'Searching for', searchTerm ); + + player.findSongOnAppleMusic( searchTerm ) .then( d => { let url = d.data.results.songs.data[ 0 ].attributes.artwork.url; @@ -560,7 +565,7 @@ prepNiceDurationTime( playingSong ); notificationHandler.emit( 'playlist-index-update', currentlyPlayingSongIndex.value ); notificationHandler.emit( 'playback-update', isPlaying.value ); - notificationHandler.emit( 'playback-start-update', new Date().getTime() - pos.value * 1000 ); + notificationHandler.emit( 'playback-start-update', new Date().getTime() - ( pos.value * 1000 ) ); hasStarted = true; }, 2000 ); } @@ -574,7 +579,7 @@ nicePlaybackPos.value = '0' + minuteCount + ':'; } - const secondCount = Math.floor( pos.value - minuteCount * 60 ); + const secondCount = Math.floor( pos.value - ( minuteCount * 60 ) ); if ( ( '' + secondCount ).length === 1 ) { nicePlaybackPos.value += '0' + secondCount; @@ -591,7 +596,7 @@ niceDuration.value = '-0' + minuteCounts + ':'; } - const secondCounts = Math.floor( ( playingSong.duration - pos.value ) - minuteCounts * 60 ); + const secondCounts = Math.floor( ( playingSong.duration - pos.value ) - ( minuteCounts * 60 ) ); if ( ( '' + secondCounts ).length === 1 ) { niceDuration.value += '0' + secondCounts;