From d57effe97cb6dbee7ad7a28a4688bc85aa4e5554 Mon Sep 17 00:00:00 2001 From: Keagan Hilliard Date: Thu, 3 Nov 2022 09:32:50 -0600 Subject: [PATCH] Fixed a couple of issues, should be working well now --- server/managers/AudioMetadataManager.js | 2 +- server/utils/toneHelpers.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/managers/AudioMetadataManager.js b/server/managers/AudioMetadataManager.js index bcf51aed..88bb83e9 100644 --- a/server/managers/AudioMetadataManager.js +++ b/server/managers/AudioMetadataManager.js @@ -57,7 +57,7 @@ class AudioMetadataMangaer { const results = [] for (const af of audioFiles) { - const result = await this.updateAudioFileMetadataWithTone(libraryItem.id, af, toneMetadataObject, itemCacheDir) + const result = await this.updateAudioFileMetadataWithTone(libraryItem.id, af, toneJsonPath, itemCacheDir) results.push(result) } diff --git a/server/utils/toneHelpers.js b/server/utils/toneHelpers.js index 54add6bd..ff57bf1e 100644 --- a/server/utils/toneHelpers.js +++ b/server/utils/toneHelpers.js @@ -126,19 +126,20 @@ module.exports.writeToneMetadataJsonFile = (libraryItem, filePath) => { let metadataChapters = [] for (const chapter of chapters) { metadataChapters.push({ - start: chapter.start, - length: chapter.end - chapter.start, + start: Math.round(chapter.start * 1000), + length: Math.round((chapter.end - chapter.start) * 1000), title: chapter.title, }) } - metadataObject['chapters'] = chaptersFile + metadataObject['chapters'] = metadataChapters } - return fs.writeFile(filePath, JSON.stringify({ metadata: metadataObject })) + return fs.writeFile(filePath, JSON.stringify({ meta: metadataObject })) } module.exports.tagAudioFile = (filePath, payload) => { return tone.tag(filePath, payload).then((data) => { + Logger.info('Tone results: ', data) return true }).catch((error) => { Logger.error(`[toneHelpers] tagAudioFile: Failed for "${filePath}"`, error)