Fixed improper metadata updating

This commit is contained in:
Michael Peters 2019-09-27 12:57:49 -04:00
parent 0ddf4480c7
commit 75284afdfc
2 changed files with 15 additions and 11 deletions

View File

@ -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'
]
);

View File

@ -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() {