Skip to content

Commit

Permalink
Added save button to Tools tab
Browse files Browse the repository at this point in the history
Still working on getting the default bitrate to be persistent
  • Loading branch information
nichwall committed Jan 19, 2024
1 parent 5b85d01 commit 71ab302
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
11 changes: 10 additions & 1 deletion client/components/modals/libraries/EditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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]
Expand Down
15 changes: 9 additions & 6 deletions client/components/modals/libraries/LibraryTools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -60,9 +60,6 @@ export default {
isBookLibrary() {
return this.mediaType === 'book'
},
bitrateType() {
return this.bitrateType
},
encodingPresets() {
return [
{
Expand Down Expand Up @@ -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>
1 change: 1 addition & 0 deletions client/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions server/models/Library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down
3 changes: 3 additions & 0 deletions server/objects/settings/LibrarySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -41,6 +43,7 @@ class LibrarySettings {
autoScanCronExpression: this.autoScanCronExpression,
audiobooksOnly: this.audiobooksOnly,
hideSingleBookSeries: this.hideSingleBookSeries,
bitrateType: this.bitrateType,
metadataPrecedence: [...this.metadataPrecedence]
}
}
Expand Down

0 comments on commit 71ab302

Please sign in to comment.