2022-04-15 00:15:52 +02:00
|
|
|
const { BookCoverAspectRatio } = require('../../utils/constants')
|
|
|
|
const Logger = require('../../Logger')
|
|
|
|
|
|
|
|
class LibrarySettings {
|
|
|
|
constructor(settings) {
|
|
|
|
this.disableWatcher = false
|
2022-04-27 02:36:29 +02:00
|
|
|
this.skipMatchingMediaWithAsin = false
|
|
|
|
this.skipMatchingMediaWithIsbn = false
|
2022-04-15 00:15:52 +02:00
|
|
|
|
|
|
|
if (settings) {
|
|
|
|
this.construct(settings)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
construct(settings) {
|
|
|
|
this.disableWatcher = !!settings.disableWatcher
|
2022-04-27 02:36:29 +02:00
|
|
|
this.skipMatchingMediaWithAsin = !!settings.skipMatchingMediaWithAsin
|
|
|
|
this.skipMatchingMediaWithIsbn = !!settings.skipMatchingMediaWithIsbn
|
2022-04-15 00:15:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
toJSON() {
|
|
|
|
return {
|
2022-04-27 02:36:29 +02:00
|
|
|
disableWatcher: this.disableWatcher,
|
|
|
|
skipMatchingMediaWithAsin: this.skipMatchingMediaWithAsin,
|
|
|
|
skipMatchingMediaWithIsbn: this.skipMatchingMediaWithIsbn
|
2022-04-15 00:15:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
update(payload) {
|
|
|
|
var hasUpdates = false
|
|
|
|
for (const key in payload) {
|
|
|
|
if (this[key] !== payload[key]) {
|
|
|
|
this[key] = payload[key]
|
|
|
|
hasUpdates = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return hasUpdates
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = LibrarySettings
|