@@ -35,9 +44,13 @@ export default {
data() {
return {
provider: null,
+ useSquareBookCovers: false,
disableWatcher: false,
skipMatchingMediaWithAsin: false,
- skipMatchingMediaWithIsbn: false
+ skipMatchingMediaWithIsbn: false,
+ tooltips: {
+ coverAspectRatio: 'Prefer to use square covers over standard 1.6:1 book covers'
+ }
}
},
computed: {
@@ -59,6 +72,7 @@ export default {
getLibraryData() {
return {
settings: {
+ coverAspectRatio: this.useSquareBookCovers ? this.$constants.BookCoverAspectRatio.SQUARE : this.$constants.BookCoverAspectRatio.STANDARD,
disableWatcher: !!this.disableWatcher,
skipMatchingMediaWithAsin: !!this.skipMatchingMediaWithAsin,
skipMatchingMediaWithIsbn: !!this.skipMatchingMediaWithIsbn
@@ -69,6 +83,7 @@ export default {
this.$emit('update', this.getLibraryData())
},
init() {
+ this.useSquareBookCovers = this.librarySettings.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
this.disableWatcher = !!this.librarySettings.disableWatcher
this.skipMatchingMediaWithAsin = !!this.librarySettings.skipMatchingMediaWithAsin
this.skipMatchingMediaWithIsbn = !!this.librarySettings.skipMatchingMediaWithIsbn
diff --git a/client/components/modals/podcast/ViewEpisode.vue b/client/components/modals/podcast/ViewEpisode.vue
index 04ab78c4..2c46f420 100644
--- a/client/components/modals/podcast/ViewEpisode.vue
+++ b/client/components/modals/podcast/ViewEpisode.vue
@@ -66,7 +66,7 @@ export default {
return this.mediaMetadata.author
},
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
}
},
methods: {},
diff --git a/client/components/tables/CollectionBooksTable.vue b/client/components/tables/CollectionBooksTable.vue
index 2fc7f0f0..0c3a18ec 100644
--- a/client/components/tables/CollectionBooksTable.vue
+++ b/client/components/tables/CollectionBooksTable.vue
@@ -52,11 +52,8 @@ export default {
}
},
computed: {
- coverAspectRatio() {
- return this.$store.getters['getServerSetting']('coverAspectRatio')
- },
bookCoverAspectRatio() {
- return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
totalDuration() {
var _total = 0
diff --git a/client/components/widgets/AuthorsSlider.vue b/client/components/widgets/AuthorsSlider.vue
index 0a2da4f7..2a93f6a1 100644
--- a/client/components/widgets/AuthorsSlider.vue
+++ b/client/components/widgets/AuthorsSlider.vue
@@ -46,7 +46,7 @@ export default {
},
computed: {
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
cardScaleMulitiplier() {
return this.height / 192
diff --git a/client/components/widgets/EpisodeSlider.vue b/client/components/widgets/EpisodeSlider.vue
index 1b1c7499..7b906a48 100644
--- a/client/components/widgets/EpisodeSlider.vue
+++ b/client/components/widgets/EpisodeSlider.vue
@@ -46,7 +46,7 @@ export default {
},
computed: {
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
cardScaleMulitiplier() {
return this.height / 192
diff --git a/client/components/widgets/ItemSlider.vue b/client/components/widgets/ItemSlider.vue
index 37ed95ce..530be981 100644
--- a/client/components/widgets/ItemSlider.vue
+++ b/client/components/widgets/ItemSlider.vue
@@ -46,7 +46,7 @@ export default {
},
computed: {
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
cardScaleMulitiplier() {
return this.height / 192
diff --git a/client/components/widgets/SeriesSlider.vue b/client/components/widgets/SeriesSlider.vue
index 48dff401..60e19928 100644
--- a/client/components/widgets/SeriesSlider.vue
+++ b/client/components/widgets/SeriesSlider.vue
@@ -46,7 +46,7 @@ export default {
},
computed: {
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
cardScaleMulitiplier() {
return this.height / 192
diff --git a/client/mixins/bookshelfCardsHelpers.js b/client/mixins/bookshelfCardsHelpers.js
index 84bdc9d7..7d4cd65c 100644
--- a/client/mixins/bookshelfCardsHelpers.js
+++ b/client/mixins/bookshelfCardsHelpers.js
@@ -51,7 +51,7 @@ export default {
index,
width: this.entityWidth,
height: this.entityHeight,
- bookCoverAspectRatio: this.bookCoverAspectRatio,
+ bookCoverAspectRatio: this.coverAspectRatio,
bookshelfView: this.bookshelfView,
sortingIgnorePrefix: !!this.sortingIgnorePrefix
}
diff --git a/client/pages/batch/index.vue b/client/pages/batch/index.vue
index 54b82d86..90dad226 100644
--- a/client/pages/batch/index.vue
+++ b/client/pages/batch/index.vue
@@ -144,12 +144,6 @@ export default {
isPodcastLibrary() {
return this.mediaType === 'podcast'
},
- coverAspectRatio() {
- return this.$store.getters['getServerSetting']('coverAspectRatio')
- },
- bookCoverAspectRatio() {
- return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
- },
streamLibraryItem() {
return this.$store.state.streamLibraryItem
},
diff --git a/client/pages/collection/_id.vue b/client/pages/collection/_id.vue
index 22b63703..d55cb049 100644
--- a/client/pages/collection/_id.vue
+++ b/client/pages/collection/_id.vue
@@ -65,7 +65,7 @@ export default {
},
computed: {
bookCoverAspectRatio() {
- return this.$store.getters['getBookCoverAspectRatio']
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
streamLibraryItem() {
return this.$store.state.streamLibraryItem
diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue
index a20ecece..816fad22 100644
--- a/client/pages/config/index.vue
+++ b/client/pages/config/index.vue
@@ -52,7 +52,7 @@
Display
-
+
diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue
index 78b9d0e0..e6fe67ed 100644
--- a/client/pages/config/users/_id/index.vue
+++ b/client/pages/config/users/_id/index.vue
@@ -105,11 +105,8 @@ export default {
userToken() {
return this.user.token
},
- coverAspectRatio() {
- return this.$store.getters['getServerSetting']('coverAspectRatio')
- },
bookCoverAspectRatio() {
- return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
username() {
return this.user.username
diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue
index 35cc5074..5b711ad8 100644
--- a/client/pages/item/_id/index.vue
+++ b/client/pages/item/_id/index.vue
@@ -246,11 +246,8 @@ export default {
isFile() {
return this.libraryItem.isFile
},
- coverAspectRatio() {
- return this.$store.getters['getServerSetting']('coverAspectRatio')
- },
bookCoverAspectRatio() {
- return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
+ return this.$store.getters['libraries/getBookCoverAspectRatio']
},
bookCoverWidth() {
return 208
diff --git a/client/store/libraries.js b/client/store/libraries.js
index ded8d5ee..54153f45 100644
--- a/client/store/libraries.js
+++ b/client/store/libraries.js
@@ -42,6 +42,14 @@ export const getters = {
})
if (!librariesSorted.length) return null
return librariesSorted[0]
+ },
+ getCurrentLibrarySettings: (state, getters) => {
+ if (!getters.getCurrentLibrary) return null
+ return getters.getCurrentLibrary.settings
+ },
+ getBookCoverAspectRatio: (state, getters) => {
+ if (!getters.getCurrentLibrarySettings || isNaN(getters.getCurrentLibrarySettings.coverAspectRatio)) return 1
+ return getters.getCurrentLibrarySettings.coverAspectRatio === 0 ? 1.6 : 1
}
}
diff --git a/server/Db.js b/server/Db.js
index 4c2d55c3..4b23d436 100644
--- a/server/Db.js
+++ b/server/Db.js
@@ -121,7 +121,7 @@ class Db {
async init() {
await this.load()
- if (!this.serverSettings) {
+ if (!this.serverSettings) { // Create first load server settings
this.serverSettings = new ServerSettings()
await this.insertEntity('settings', this.serverSettings)
}
@@ -142,7 +142,7 @@ class Db {
this.libraries.sort((a, b) => a.displayOrder - b.displayOrder)
Logger.info(`[DB] ${this.libraries.length} Libraries Loaded`)
})
- var p4 = this.settingsDb.select(() => true).then((results) => {
+ var p4 = this.settingsDb.select(() => true).then(async (results) => {
if (results.data && results.data.length) {
this.settings = results.data
var serverSettings = this.settings.find(s => s.id === 'server-settings')
@@ -152,6 +152,18 @@ class Db {
// Check if server was upgraded
if (!this.serverSettings.version || this.serverSettings.version !== version) {
this.previousVersion = this.serverSettings.version || '1.0.0'
+
+ // Library settings and server settings updated in 2.1.3 - run migration
+ if (this.previousVersion.localeCompare('2.1.3') < 0) {
+ Logger.info(`[Db] Running servers & library settings migration`)
+ for (const library of this.libraries) {
+ if (library.settings.coverAspectRatio !== serverSettings.coverAspectRatio) {
+ library.settings.coverAspectRatio = serverSettings.coverAspectRatio
+ await this.updateEntity('library', library)
+ Logger.debug(`[Db] Library ${library.name} migrated`)
+ }
+ }
+ }
}
}
}
@@ -357,22 +369,7 @@ class Db {
}
return entityDb.update((record) => record.id === entity.id, () => jsonEntity).then((results) => {
- if (process.env.NODE_ENV !== 'production') {
- Logger.debug(`[DB] Updated ${entityName}: ${results.updated} | Selected: ${results.selected}`)
-
- if (!results.selected) {
- entityDb.select(match => match.id == jsonEntity.id).then((results) => {
- if (results.data.length) {
- console.log('Said selected 0 but found it right here...', results.data[0].id)
- } else {
- console.log('Said selected 0 and no results for json entity id', jsonEntity.id)
- }
- })
- }
- } else {
- Logger.debug(`[DB] Updated ${entityName}: ${results.updated}`)
- }
-
+ Logger.debug(`[DB] Updated ${entityName}: ${results.updated}`)
var arrayKey = this.getEntityArrayKey(entityName)
if (this[arrayKey]) {
this[arrayKey] = this[arrayKey].map(e => {
diff --git a/server/objects/settings/LibrarySettings.js b/server/objects/settings/LibrarySettings.js
index 25c82f28..8dcaee07 100644
--- a/server/objects/settings/LibrarySettings.js
+++ b/server/objects/settings/LibrarySettings.js
@@ -1,8 +1,8 @@
const { BookCoverAspectRatio } = require('../../utils/constants')
-const Logger = require('../../Logger')
class LibrarySettings {
constructor(settings) {
+ this.coverAspectRatio = BookCoverAspectRatio.SQUARE
this.disableWatcher = false
this.skipMatchingMediaWithAsin = false
this.skipMatchingMediaWithIsbn = false
@@ -13,6 +13,7 @@ class LibrarySettings {
}
construct(settings) {
+ this.coverAspectRatio = !isNaN(settings.coverAspectRatio) ? settings.coverAspectRatio : BookCoverAspectRatio.SQUARE
this.disableWatcher = !!settings.disableWatcher
this.skipMatchingMediaWithAsin = !!settings.skipMatchingMediaWithAsin
this.skipMatchingMediaWithIsbn = !!settings.skipMatchingMediaWithIsbn
@@ -20,6 +21,7 @@ class LibrarySettings {
toJSON() {
return {
+ coverAspectRatio: this.coverAspectRatio,
disableWatcher: this.disableWatcher,
skipMatchingMediaWithAsin: this.skipMatchingMediaWithAsin,
skipMatchingMediaWithIsbn: this.skipMatchingMediaWithIsbn