Compare commits

..

No commits in common. "df45347690c5902ea73b2a9f49f0f32ac658a585" and "5ac6b85da17a219c40bb0af7325f147c56510fe8" have entirely different histories.

2 changed files with 21 additions and 28 deletions

View file

@ -74,12 +74,19 @@ export default {
mediaTracks() { mediaTracks() {
return this.media.tracks || [] return this.media.tracks || []
}, },
isSingleM4b() {
return this.mediaTracks.length === 1 && this.mediaTracks[0].metadata.ext.toLowerCase() === '.m4b'
},
chapters() { chapters() {
return this.media.chapters || [] return this.media.chapters || []
}, },
showM4bDownload() { showM4bDownload() {
if (!this.mediaTracks.length) return false if (!this.mediaTracks.length) return false
return true return !this.isSingleM4b
},
showMp3Split() {
if (!this.mediaTracks.length) return false
return this.isSingleM4b && this.chapters.length
}, },
queuedEmbedLIds() { queuedEmbedLIds() {
return this.$store.state.tasks.queuedEmbedLIds || [] return this.$store.state.tasks.queuedEmbedLIds || []

View file

@ -2,14 +2,7 @@
<div id="page-wrapper" class="bg-bg page p-8 overflow-auto relative" :class="streamLibraryItem ? 'streaming' : ''"> <div id="page-wrapper" class="bg-bg page p-8 overflow-auto relative" :class="streamLibraryItem ? 'streaming' : ''">
<div class="flex items-center justify-center mb-6"> <div class="flex items-center justify-center mb-6">
<div class="w-full max-w-2xl"> <div class="w-full max-w-2xl">
<div class="flex items-center mb-4"> <p class="text-2xl mb-2">{{ $strings.HeaderAudiobookTools }}</p>
<nuxt-link :to="`/item/${libraryItem.id}`" class="hover:underline">
<h1 class="text-lg lg:text-xl">{{ mediaMetadata.title }}</h1>
</nuxt-link>
<button class="w-7 h-7 flex items-center justify-center mx-4 hover:scale-110 duration-100 transform text-gray-200 hover:text-white" @click="editItem">
<span class="material-symbols text-base">edit</span>
</button>
</div>
</div> </div>
<div class="w-full max-w-2xl"> <div class="w-full max-w-2xl">
<div class="flex justify-end"> <div class="flex justify-end">
@ -20,7 +13,7 @@
<div class="flex justify-center mb-2"> <div class="flex justify-center mb-2">
<div class="w-full max-w-2xl"> <div class="w-full max-w-2xl">
<p class="text-lg">{{ $strings.HeaderMetadataToEmbed }}</p> <p class="text-xl">{{ $strings.HeaderMetadataToEmbed }}</p>
</div> </div>
<div class="w-full max-w-2xl"></div> <div class="w-full max-w-2xl"></div>
</div> </div>
@ -273,6 +266,9 @@ export default {
audioFiles() { audioFiles() {
return (this.media.audioFiles || []).filter((af) => !af.exclude) return (this.media.audioFiles || []).filter((af) => !af.exclude)
}, },
isSingleM4b() {
return this.audioFiles.length === 1 && this.audioFiles[0].metadata.ext.toLowerCase() === '.m4b'
},
streamLibraryItem() { streamLibraryItem() {
return this.$store.state.streamLibraryItem return this.$store.state.streamLibraryItem
}, },
@ -280,10 +276,14 @@ export default {
return this.media.chapters || [] return this.media.chapters || []
}, },
availableTools() { availableTools() {
return [ if (this.isSingleM4b) {
{ value: 'embed', text: this.$strings.LabelToolsEmbedMetadata }, return [{ value: 'embed', text: this.$strings.LabelToolsEmbedMetadata }]
{ value: 'm4b', text: this.$strings.LabelToolsM4bEncoder } } else {
] return [
{ value: 'embed', text: this.$strings.LabelToolsEmbedMetadata },
{ value: 'm4b', text: this.$strings.LabelToolsM4bEncoder }
]
}
}, },
taskFailed() { taskFailed() {
return this.isTaskFinished && this.task.isFailed return this.isTaskFinished && this.task.isFailed
@ -431,24 +431,10 @@ export default {
}, },
taskUpdated(task) { taskUpdated(task) {
this.processing = !task.isFinished this.processing = !task.isFinished
},
editItem() {
this.$store.commit('showEditModal', this.libraryItem)
},
libraryItemUpdated(libraryItem) {
if (libraryItem.id === this.libraryItem.id) {
this.libraryItem = libraryItem
this.fetchMetadataEmbedObject()
}
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.$eventBus.$on(`${this.libraryItem.id}_updated`, this.libraryItemUpdated)
},
beforeDestroy() {
this.$eventBus.$off(`${this.libraryItem.id}_updated`, this.libraryItemUpdated)
} }
} }
</script> </script>