mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-12 10:25:02 +02:00
Use local image as cover if found, adding release-it version control
This commit is contained in:
parent
7d4e2e3d97
commit
f30fa2fb0c
18 changed files with 2200 additions and 142 deletions
|
@ -1,3 +1,4 @@
|
|||
const Path = require('path')
|
||||
class Book {
|
||||
constructor(book = null) {
|
||||
this.olid = null
|
||||
|
@ -42,7 +43,6 @@ class Book {
|
|||
}
|
||||
|
||||
setData(data) {
|
||||
console.log('SET DATA', data)
|
||||
this.olid = data.olid || null
|
||||
this.title = data.title || null
|
||||
this.author = data.author || null
|
||||
|
@ -51,6 +51,14 @@ class Book {
|
|||
this.description = data.description || null
|
||||
this.cover = data.cover || null
|
||||
this.genres = data.genres || []
|
||||
|
||||
// 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.join('/local', imageFile.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(payload) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue