mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-02 17:24:57 +02:00
Book cover uploader, moving streams to /metadata/streams, adding jwt auth from query string, auth check static metadata
This commit is contained in:
parent
ae1b94e991
commit
b23f9362ef
18 changed files with 377 additions and 36 deletions
|
@ -288,6 +288,12 @@ class Audiobook {
|
|||
return hasUpdates
|
||||
}
|
||||
|
||||
// Cover Url may be the same, this ensures the lastUpdate is updated
|
||||
updateBookCover(cover) {
|
||||
if (!this.book) return false
|
||||
return this.book.updateCover(cover)
|
||||
}
|
||||
|
||||
updateAudioTracks(orderedFileData) {
|
||||
var index = 1
|
||||
this.audioFiles = orderedFileData.map((fileData) => {
|
||||
|
|
|
@ -18,6 +18,7 @@ class Book {
|
|||
this.description = null
|
||||
this.cover = null
|
||||
this.genres = []
|
||||
this.lastUpdate = null
|
||||
|
||||
if (book) {
|
||||
this.construct(book)
|
||||
|
@ -45,6 +46,7 @@ class Book {
|
|||
this.description = book.description
|
||||
this.cover = book.cover
|
||||
this.genres = book.genres
|
||||
this.lastUpdate = book.lastUpdate || Date.now()
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
@ -62,7 +64,8 @@ class Book {
|
|||
publisher: this.publisher,
|
||||
description: this.description,
|
||||
cover: this.cover,
|
||||
genres: this.genres
|
||||
genres: this.genres,
|
||||
lastUpdate: this.lastUpdate
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +100,7 @@ class Book {
|
|||
this.description = data.description || null
|
||||
this.cover = data.cover || null
|
||||
this.genres = data.genres || []
|
||||
this.lastUpdate = Date.now()
|
||||
|
||||
if (data.author) {
|
||||
this.setParseAuthor(this.author)
|
||||
|
@ -145,9 +149,24 @@ class Book {
|
|||
hasUpdates = true
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUpdates) {
|
||||
this.lastUpdate = Date.now()
|
||||
}
|
||||
|
||||
return hasUpdates
|
||||
}
|
||||
|
||||
updateCover(cover) {
|
||||
if (!cover) return false
|
||||
if (!cover.startsWith('http:') && !cover.startsWith('https:')) {
|
||||
cover = Path.normalize(cover)
|
||||
}
|
||||
this.cover = cover
|
||||
this.lastUpdate = Date.now()
|
||||
return true
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
const { CoverDestination } = require('../utils/constants')
|
||||
|
||||
class ServerSettings {
|
||||
constructor(settings) {
|
||||
this.id = 'server-settings'
|
||||
this.autoTagNew = false
|
||||
this.newTagExpireDays = 15
|
||||
this.scannerParseSubtitle = false
|
||||
this.coverDestination = CoverDestination.METADATA
|
||||
|
||||
if (settings) {
|
||||
this.construct(settings)
|
||||
|
@ -14,6 +17,7 @@ class ServerSettings {
|
|||
this.autoTagNew = settings.autoTagNew
|
||||
this.newTagExpireDays = settings.newTagExpireDays
|
||||
this.scannerParseSubtitle = settings.scannerParseSubtitle
|
||||
this.coverDestination = settings.coverDestination || CoverDestination.METADATA
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
@ -21,7 +25,8 @@ class ServerSettings {
|
|||
id: this.id,
|
||||
autoTagNew: this.autoTagNew,
|
||||
newTagExpireDays: this.newTagExpireDays,
|
||||
scannerParseSubtitle: this.scannerParseSubtitle
|
||||
scannerParseSubtitle: this.scannerParseSubtitle,
|
||||
coverDestination: this.coverDestination
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ class Stream extends EventEmitter {
|
|||
|
||||
var perc = (this.segmentsCreated.size * 100 / this.numSegments).toFixed(2) + '%'
|
||||
Logger.info('[STREAM-CHECK] Check Files', this.segmentsCreated.size, 'of', this.numSegments, perc, `Furthest Segment: ${this.furthestSegmentCreated}`)
|
||||
Logger.info('[STREAM-CHECK] Chunks', chunks.join(', '))
|
||||
Logger.debug('[STREAM-CHECK] Chunks', chunks.join(', '))
|
||||
|
||||
this.socket.emit('stream_progress', {
|
||||
stream: this.id,
|
||||
|
@ -198,7 +198,7 @@ class Stream extends EventEmitter {
|
|||
numSegments: this.numSegments
|
||||
})
|
||||
} catch (error) {
|
||||
Logger.error('Failed checkign files', error)
|
||||
Logger.error('Failed checking files', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue