From 49054d5239380c36027b5f09375acfd474656afb Mon Sep 17 00:00:00 2001 From: Shaun Date: Wed, 31 Jul 2024 16:44:24 +1000 Subject: [PATCH] persist the advanced encoding options, show the encoding options used with in progress encodes --- client/pages/audiobook/_id/manage.vue | 32 ++++++++++++++++++++++----- server/managers/AbMergeManager.js | 3 ++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/client/pages/audiobook/_id/manage.vue b/client/pages/audiobook/_id/manage.vue index 464d7ce2e7..6be07349be 100644 --- a/client/pages/audiobook/_id/manage.vue +++ b/client/pages/audiobook/_id/manage.vue @@ -78,7 +78,7 @@
@@ -92,11 +92,11 @@
-
+
- - - + + +

Warning: Do not update these settings unless you are familiar with ffmpeg encoding options.

@@ -308,12 +308,24 @@ export default { }, isMetadataEmbedQueued() { return this.queuedEmbedLIds.some((lid) => lid === this.libraryItemId) + }, + usingCustomEncodeOptions() { + return this.isM4BTool && this.encodeTask && this.encodeTask.data.encodeOptions && Object.keys(this.encodeTask.data.encodeOptions).length > 0 } }, methods: { toggleBackupAudioFiles(val) { localStorage.setItem('embedMetadataShouldBackup', val ? 1 : 0) }, + bitrateChanged(val) { + localStorage.setItem('embedMetadataBitrate', val) + }, + channelsChanged(val) { + localStorage.setItem('embedMetadataChannels', val) + }, + codecChanged(val) { + localStorage.setItem('embedMetadataCodec', val) + }, cancelEncodeClick() { this.isCancelingEncode = true this.$axios @@ -398,6 +410,16 @@ export default { const shouldBackupAudioFiles = localStorage.getItem('embedMetadataShouldBackup') this.shouldBackupAudioFiles = shouldBackupAudioFiles != 0 + + if (this.usingCustomEncodeOptions) { + if (this.encodeTask.data.encodeOptions.bitrate) this.encodingOptions.bitrate = this.encodeTask.data.encodeOptions.bitrate + if (this.encodeTask.data.encodeOptions.channels) this.encodingOptions.channels = this.encodeTask.data.encodeOptions.channels + if (this.encodeTask.data.encodeOptions.codec) this.encodingOptions.codec = this.encodeTask.data.encodeOptions.codec + } else { + this.encodingOptions.bitrate = localStorage.getItem('embedMetadataBitrate') || '128k' + this.encodingOptions.channels = localStorage.getItem('embedMetadataChannels') || '2' + this.encodingOptions.codec = localStorage.getItem('embedMetadataCodec') || 'aac' + } }, fetchMetadataEmbedObject() { this.$axios diff --git a/server/managers/AbMergeManager.js b/server/managers/AbMergeManager.js index 61c1d500e1..5d3fea8fb9 100644 --- a/server/managers/AbMergeManager.js +++ b/server/managers/AbMergeManager.js @@ -48,7 +48,8 @@ class AbMergeManager { chapters: libraryItem.media.chapters?.map((c) => ({ ...c })), coverPath: libraryItem.media.coverPath, ffmetadataPath, - duration: libraryItem.media.duration + duration: libraryItem.media.duration, + encodeOptions: options } const taskDescription = `Encoding audiobook "${libraryItem.media.metadata.title}" into a single m4b file.` task.setData('encode-m4b', 'Encoding M4b', taskDescription, false, taskData)