From f7a3dbf209cee0316a27b3318ce00c831e157362 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 22 Jan 2023 18:02:57 -0600 Subject: [PATCH] Fix:Embed metadata tool embeds cover image --- server/managers/AudioMetadataManager.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/managers/AudioMetadataManager.js b/server/managers/AudioMetadataManager.js index 641a7e1c..c32049cc 100644 --- a/server/managers/AudioMetadataManager.js +++ b/server/managers/AudioMetadataManager.js @@ -60,7 +60,7 @@ class AudioMetadataMangaer { const results = [] for (const af of audioFiles) { - const result = await this.updateAudioFileMetadataWithTone(libraryItem.id, af, toneJsonPath, itemCacheDir, backupFiles) + const result = await this.updateAudioFileMetadataWithTone(libraryItem, af, toneJsonPath, itemCacheDir, backupFiles) results.push(result) } @@ -82,9 +82,9 @@ class AudioMetadataMangaer { SocketAuthority.emitter('audio_metadata_finished', itemAudioMetadataPayload) } - async updateAudioFileMetadataWithTone(libraryItemId, audioFile, toneJsonPath, itemCacheDir, backupFiles) { + async updateAudioFileMetadataWithTone(libraryItem, audioFile, toneJsonPath, itemCacheDir, backupFiles) { const resultPayload = { - libraryItemId, + libraryItemId: libraryItem.id, index: audioFile.index, ino: audioFile.ino, filename: audioFile.metadata.filename @@ -107,6 +107,10 @@ class AudioMetadataMangaer { 'TrackNumber': audioFile.index, } + if (libraryItem.media.coverPath) { + _toneMetadataObject['CoverFile'] = libraryItem.media.coverPath + } + resultPayload.success = await toneHelpers.tagAudioFile(audioFile.metadata.path, _toneMetadataObject) if (resultPayload.success) { Logger.info(`[AudioMetadataManager] Successfully tagged audio file "${audioFile.metadata.path}"`)