Support for libraries and folder mapping, updating static cover path, detect reader.txt

This commit is contained in:
advplyr 2021-10-04 22:11:42 -05:00
parent a590e795e3
commit 577f3bead9
43 changed files with 2548 additions and 768 deletions

View file

@ -18,6 +18,7 @@ class Book {
this.publisher = null
this.description = null
this.cover = null
this.coverFullPath = null
this.genres = []
this.lastUpdate = null
@ -46,6 +47,7 @@ class Book {
this.publisher = book.publisher
this.description = book.description
this.cover = book.cover
this.coverFullPath = book.coverFullPath || null
this.genres = book.genres
this.lastUpdate = book.lastUpdate || Date.now()
}
@ -65,6 +67,7 @@ class Book {
publisher: this.publisher,
description: this.description,
cover: this.cover,
coverFullPath: this.coverFullPath,
genres: this.genres,
lastUpdate: this.lastUpdate
}
@ -100,20 +103,13 @@ class Book {
this.publishYear = data.publishYear || null
this.description = data.description || null
this.cover = data.cover || null
this.coverFullPath = data.coverFullPath || null
this.genres = data.genres || []
this.lastUpdate = Date.now()
if (data.author) {
this.setParseAuthor(this.author)
}
// Use first image file as cover
if (data.otherFiles && data.otherFiles.length) {
var imageFile = data.otherFiles.find(f => f.filetype === 'image')
if (imageFile) {
this.cover = Path.normalize(Path.join('/local', imageFile.path))
}
}
}
update(payload) {
@ -168,6 +164,12 @@ class Book {
return true
}
removeCover() {
this.cover = null
this.coverFullPath = null
this.lastUpdate = Date.now()
}
// If audiobook directory path was changed, check and update properties set from dirnames
// May be worthwhile checking if these were manually updated and not override manual updates
syncPathsUpdated(audiobookData) {