Use local image as cover if found, adding release-it version control

This commit is contained in:
advplyr 2021-08-21 13:02:24 -05:00
parent 7d4e2e3d97
commit f30fa2fb0c
18 changed files with 2200 additions and 142 deletions

View file

@ -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) {