Added save button to Tools tab

Still working on getting the default bitrate to be persistent
This commit is contained in:
Nicholas W 2024-01-19 17:32:11 +00:00
parent 5b85d01d55
commit 71ab302d11
5 changed files with 24 additions and 7 deletions

View file

@ -14,7 +14,7 @@
<div class="px-2 md:px-4 w-full text-sm pt-2 md:pt-6 pb-20 rounded-b-lg rounded-tr-lg bg-bg shadow-lg border border-black-300 relative overflow-hidden" style="min-height: 400px; max-height: 80vh">
<component v-if="libraryCopy && show" ref="tabComponent" :is="tabName" :is-new="!library" :library="libraryCopy" :library-id="libraryId" :processing.sync="processing" @update="updateLibrary" @close="show = false" />
<div v-show="selectedTab !== 'tools'" class="absolute bottom-0 left-0 w-full px-4 py-4 border-t border-white border-opacity-10">
<div class="absolute bottom-0 left-0 w-full px-4 py-4 border-t border-white border-opacity-10">
<div class="flex justify-end">
<ui-btn @click="submit">{{ buttonText }}</ui-btn>
</div>
@ -190,6 +190,15 @@ export default {
}
} else if (key === 'settings') {
for (const settingsKey in this.libraryCopy.settings) {
console.log('Settings settings key', this.library.settings[settingsKey])
if (this.libraryCopy.settings[settingsKey] !== this.library.settings[settingsKey]) {
if (!updatePayload.settings) updatePayload.settings = {}
updatePayload.settings[settingsKey] = this.libraryCopy.settings[settingsKey]
}
}
} else if (key === 'tools') {
for (const settingsKey in this.libraryCopy.settings) {
console.log('Tools settings key', this.library.settings[settingsKey])
if (this.libraryCopy.settings[settingsKey] !== this.library.settings[settingsKey]) {
if (!updatePayload.settings) updatePayload.settings = {}
updatePayload.settings[settingsKey] = this.libraryCopy.settings[settingsKey]

View file

@ -23,10 +23,10 @@
</div>
<div class="flex-grow" />
<div class="w-1/7 md:w-42 px-1 py-1 md:py-0">
<ui-dropdown v-model="bitrateType" :items="encodingPresets" :label="$strings.LabelMediaType" small @input="changedEncodingPresets" />
<ui-dropdown v-model="bitrateType" :items="encodingPresets" :label="$strings.LabelBitrateType" small @input="changedEncodingPresets" />
</div>
<div class="w-1/8 md:w-42 px-1 py-1 md:py-0">
<ui-text-input-with-label ref="nameInput" v-model="fixedBitrate" :disabled="!isFixedBitrate" :label="$strings.LabelLibraryName" />
<ui-text-input-with-label ref="nameInput" v-model="fixedBitrate" :disabled="!isFixedBitrate" :label="$strings.LabelBitrate" />
</div>
</div>
</div>
@ -60,9 +60,6 @@ export default {
isBookLibrary() {
return this.mediaType === 'book'
},
bitrateType() {
return this.bitrateType
},
encodingPresets() {
return [
{
@ -129,8 +126,14 @@ export default {
.finally(() => {
this.$emit('update:processing', false)
})
},
init() {
this.bitrateType = this.librarySettings.bitrateType
this.fixedBitrate = this.librarySettings.fixedBitrate
}
},
mounted() {}
mounted() {
this.init()
}
}
</script>

View file

@ -214,6 +214,7 @@
"LabelBackupsNumberToKeep": "Number of backups to keep",
"LabelBackupsNumberToKeepHelp": "Only 1 backup will be removed at a time so if you already have more backups than this you should manually remove them.",
"LabelBitrate": "Bitrate",
"LabelBitrateType": "Bitrate Type",
"LabelBooks": "Books",
"LabelButtonText": "Button Text",
"LabelChangePassword": "Change Password",

View file

@ -11,6 +11,7 @@ const oldLibrary = require('../objects/Library')
* @property {string} autoScanCronExpression
* @property {boolean} audiobooksOnly
* @property {boolean} hideSingleBookSeries Do not show series that only have 1 book
* @property {boolean} bitrateType
* @property {string[]} metadataPrecedence
*/

View file

@ -9,6 +9,7 @@ class LibrarySettings {
this.autoScanCronExpression = null
this.audiobooksOnly = false
this.hideSingleBookSeries = false // Do not show series that only have 1 book
this.bitrateType = 'maxBitrate'
this.metadataPrecedence = ['folderStructure', 'audioMetatags', 'nfoFile', 'txtFiles', 'opfFile', 'absMetadata']
if (settings) {
@ -24,6 +25,7 @@ class LibrarySettings {
this.autoScanCronExpression = settings.autoScanCronExpression || null
this.audiobooksOnly = !!settings.audiobooksOnly
this.hideSingleBookSeries = !!settings.hideSingleBookSeries
this.bitrateType = settings.bitrateType || 'maxBitrate'
if (settings.metadataPrecedence) {
this.metadataPrecedence = [...settings.metadataPrecedence]
} else {
@ -41,6 +43,7 @@ class LibrarySettings {
autoScanCronExpression: this.autoScanCronExpression,
audiobooksOnly: this.audiobooksOnly,
hideSingleBookSeries: this.hideSingleBookSeries,
bitrateType: this.bitrateType,
metadataPrecedence: [...this.metadataPrecedence]
}
}