From 75284afdfc4274950c69501a311a82ed7b1c7169 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Fri, 27 Sep 2019 12:57:49 -0400 Subject: [PATCH] Fixed improper metadata updating --- client/actions.js | 13 +++++++------ client/main.js | 13 ++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client/actions.js b/client/actions.js index 3d6dafd..5509464 100644 --- a/client/actions.js +++ b/client/actions.js @@ -157,6 +157,7 @@ Actions.convertToMp3 = function(song) { '-hide_banner', '-i', '../intermediate/' + song.guid + '.wav', '-f', 'mp3', + '-b:a', '192k', '../intermediate/' + song.guid + '.mp3' ] ); @@ -168,6 +169,7 @@ Actions.addMetadata = function(song) { LOG.warn(`Cannot add metadata to ${song.name}: [${song.guid}.mp3] does not exist`); return; } + LOG.debug(`adding metadata: title: ${song.name}, artist: ${song.artists.join(' / ')}, album: ${song.album.name}`); let metadataProcess = Actions.spawnProcess( 'metadata process', 'ffmpeg', [ @@ -178,12 +180,11 @@ Actions.addMetadata = function(song) { '-map', '1:0', '-c', 'copy', '-id3v2_version', '3', - '-metadata:s:v', 'title=\'Album Cover\'', - '-metadata:s:v', 'comment=\'Cover (front)\'', - '-metadata', `title=\'${song.name}\'`, - '-metadata', `author=\'${song.artists.join(' / ')}\'`, - '-metadata', `album=\'${song.album.name}\'`, - '-b:a', '192k', + '-metadata:s:v', 'title=Album Cover', + '-metadata:s:v', 'comment=Cover (front)', + '-metadata', `title=${song.name}`, + '-metadata', `artist=${song.artists.join(' / ')}`, + '-metadata', `album=${song.album.name}`, '../audio/' + song.filename + '.mp3' ] ); diff --git a/client/main.js b/client/main.js index f0b7723..5a0a2a6 100644 --- a/client/main.js +++ b/client/main.js @@ -108,12 +108,15 @@ async function onNewSong(song) { } async function onUpdateSong(song) { - LOG.debug(`${song.filename} update song`) - window.webContents.send('update-song', song); + LOG.debug(`${song.filename} update song`, { song: song }); - LOG.debug(`${song.filename} starting full album art download`); - await Actions.downloadAlbumArt(song); - LOG.info(`${song.filename} full album art downloaded`); + currentSong = song; + + window.webContents.send('update-song', currentSong); + + LOG.debug(`${currentSong.filename} starting full album art download`); + await Actions.downloadAlbumArt(currentSong); + LOG.info(`${currentSong.filename} full album art downloaded`); } async function onAdvertisement() {