@@ -51,7 +51,8 @@ export default {
width: {
type: Number,
default: 120
- }
+ },
+ bookCoverAspectRatio: Number
},
data() {
return {
@@ -67,6 +68,12 @@ export default {
}
},
computed: {
+ squareAspectRatio() {
+ return this.bookCoverAspectRatio === 1
+ },
+ height() {
+ return this.width * this.bookCoverAspectRatio
+ },
book() {
if (!this.audiobook) return {}
return this.audiobook.book || {}
@@ -105,7 +112,8 @@ export default {
return !!this.book.cover
},
sizeMultiplier() {
- return this.width / 120
+ var baseSize = this.squareAspectRatio ? 192 : 120
+ return this.width / baseSize
},
titleFontSize() {
return 0.75 * this.sizeMultiplier
@@ -142,7 +150,7 @@ export default {
if (this.$refs.cover && this.cover !== this.placeholderUrl) {
var { naturalWidth, naturalHeight } = this.$refs.cover
var aspectRatio = naturalHeight / naturalWidth
- var arDiff = Math.abs(aspectRatio - 1.6)
+ var arDiff = Math.abs(aspectRatio - this.bookCoverAspectRatio)
// If image aspect ratio is <= 1.45 or >= 1.75 then use cover bg, otherwise stretch to fit
if (arDiff > 0.15) {
diff --git a/client/components/covers/CollectionCover.vue b/client/components/covers/CollectionCover.vue
index fea176d9..921a451c 100644
--- a/client/components/covers/CollectionCover.vue
+++ b/client/components/covers/CollectionCover.vue
@@ -13,8 +13,8 @@
@@ -32,7 +32,8 @@ export default {
default: () => []
},
width: Number,
- height: Number
+ height: Number,
+ bookCoverAspectRatio: Number
},
data() {
return {
@@ -42,7 +43,8 @@ export default {
},
computed: {
sizeMultiplier() {
- return this.width / 120
+ if (this.bookCoverAspectRatio === 1) return this.width / (120 * 1.6 * 2)
+ return this.width / 240
},
hasOwnCover() {
return false
diff --git a/client/components/covers/GroupCover.vue b/client/components/covers/GroupCover.vue
index a56a2756..d5e40e70 100644
--- a/client/components/covers/GroupCover.vue
+++ b/client/components/covers/GroupCover.vue
@@ -9,6 +9,7 @@
\ No newline at end of file
diff --git a/client/mixins/bookshelfCardsHelpers.js b/client/mixins/bookshelfCardsHelpers.js
index 2ed5ae7c..c9b7f85d 100644
--- a/client/mixins/bookshelfCardsHelpers.js
+++ b/client/mixins/bookshelfCardsHelpers.js
@@ -47,13 +47,17 @@ export default {
var ComponentClass = this.getComponentClass()
+ var props = {
+ index,
+ width: this.entityWidth,
+ height: this.entityHeight,
+ bookCoverAspectRatio: this.bookCoverAspectRatio
+ }
+ if (this.entityName === 'series-books') props.showVolumeNumber = true
+
var _this = this
var instance = new ComponentClass({
- propsData: {
- index: index,
- width: this.entityWidth,
- showVolumeNumber: this.entityName === 'series-books'
- },
+ propsData: props,
created() {
this.$on('edit', (entity) => {
if (_this.editEntity) _this.editEntity(entity)
diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue
index 5094234b..f696386b 100644
--- a/client/pages/config/index.vue
+++ b/client/pages/config/index.vue
@@ -41,6 +41,13 @@
Store covers with audiobook info_outlined
+
+
+
+
+ Use square book covers info_outlined
+
+
@@ -92,6 +99,7 @@ export default {
isResettingAudiobooks: false,
storeCoversInAudiobookDir: false,
updatingServerSettings: false,
+ useSquareBookCovers: false,
newServerSettings: {}
}
},
@@ -128,6 +136,9 @@ export default {
scannerFindCoversTooltip() {
return 'If your audiobook does not have an embedded cover or a cover image inside the folder, the scanner will attempt to find a cover.
Note: This will extend scan time'
},
+ coverAspectRatioTooltip() {
+ return 'Prefer to use square covers over standard 1.6:1 book covers'
+ },
showExperimentalFeatures: {
get() {
return this.$store.state.showExperimentalFeatures
@@ -164,6 +175,11 @@ export default {
scannerPreferOpfMetadata: !!val
})
},
+ updateBookCoverAspectRatio(val) {
+ this.updateServerSettings({
+ coverAspectRatio: val ? this.$constants.BookCoverAspectRatio.SQUARE : this.$constants.BookCoverAspectRatio.STANDARD
+ })
+ },
updateServerSettings(payload) {
this.updatingServerSettings = true
this.$store
@@ -181,6 +197,8 @@ export default {
this.newServerSettings = this.serverSettings ? { ...this.serverSettings } : {}
this.storeCoversInAudiobookDir = this.newServerSettings.coverDestination === this.$constants.CoverDestination.AUDIOBOOK
+
+ this.useSquareBookCovers = this.newServerSettings.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
},
resetAudiobooks() {
if (confirm('WARNING! This action will remove all audiobooks from the database including any updates or matches you have made. This does not do anything to your actual files. Shall we continue?')) {
diff --git a/client/plugins/constants.js b/client/plugins/constants.js
index 6c2fb551..7a237fec 100644
--- a/client/plugins/constants.js
+++ b/client/plugins/constants.js
@@ -10,9 +10,15 @@ const CoverDestination = {
AUDIOBOOK: 1
}
+const BookCoverAspectRatio = {
+ STANDARD: 0,
+ SQUARE: 1
+}
+
const Constants = {
DownloadStatus,
- CoverDestination
+ CoverDestination,
+ BookCoverAspectRatio
}
const KeyNames = {
diff --git a/client/store/index.js b/client/store/index.js
index e9242492..1f49dd61 100644
--- a/client/store/index.js
+++ b/client/store/index.js
@@ -28,6 +28,10 @@ export const getters = {
getIsAudiobookSelected: state => audiobookId => {
return !!state.selectedAudiobooks.includes(audiobookId)
},
+ getServerSetting: state => key => {
+ if (!state.serverSettings) return null
+ return state.serverSettings[key]
+ },
getNumAudiobooksSelected: state => state.selectedAudiobooks.length,
getAudiobookIdStreaming: state => {
return state.streamAudiobook ? state.streamAudiobook.id : null
diff --git a/server/objects/ServerSettings.js b/server/objects/ServerSettings.js
index 1c805316..b3695303 100644
--- a/server/objects/ServerSettings.js
+++ b/server/objects/ServerSettings.js
@@ -1,4 +1,4 @@
-const { CoverDestination } = require('../utils/constants')
+const { CoverDestination, BookCoverAspectRatio } = require('../utils/constants')
const Logger = require('../Logger')
class ServerSettings {
@@ -33,6 +33,9 @@ class ServerSettings {
this.loggerDailyLogsToKeep = 7
this.loggerScannerLogsToKeep = 2
+ // Cover
+ this.coverAspectRatio = BookCoverAspectRatio.STANDARD
+
this.logLevel = Logger.logLevel
this.version = null
@@ -61,6 +64,8 @@ class ServerSettings {
this.loggerDailyLogsToKeep = settings.loggerDailyLogsToKeep || 7
this.loggerScannerLogsToKeep = settings.loggerScannerLogsToKeep || 2
+ this.coverAspectRatio = settings.coverAspectRatio || BookCoverAspectRatio.STANDARD
+
this.logLevel = settings.logLevel || Logger.logLevel
this.version = settings.version || null
@@ -87,6 +92,7 @@ class ServerSettings {
backupMetadataCovers: this.backupMetadataCovers,
loggerDailyLogsToKeep: this.loggerDailyLogsToKeep,
loggerScannerLogsToKeep: this.loggerScannerLogsToKeep,
+ coverAspectRatio: this.coverAspectRatio,
logLevel: this.logLevel,
version: this.version
}
diff --git a/server/utils/constants.js b/server/utils/constants.js
index d36ce925..868d223d 100644
--- a/server/utils/constants.js
+++ b/server/utils/constants.js
@@ -11,6 +11,11 @@ module.exports.CoverDestination = {
AUDIOBOOK: 1
}
+module.exports.BookCoverAspectRatio = {
+ STANDARD: 0, // 1.6:1
+ SQUARE: 1
+}
+
module.exports.LogLevel = {
TRACE: 0,
DEBUG: 1,