mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 17:54:54 +02:00
Fix:Set full cover path for extracted covers & use temp fix to update books without a full cover path
This commit is contained in:
parent
d6ae50f89a
commit
57b464c867
3 changed files with 31 additions and 3 deletions
|
@ -801,7 +801,7 @@ class Audiobook {
|
|||
var success = await extractCoverArt(audioFileWithCover.fullPath, coverFilePath)
|
||||
if (success) {
|
||||
var coverRelPath = Path.join(coverDirRelPath, coverFilename).replace(/\\/g, '/').replace(/\/\//g, '/')
|
||||
this.update({ book: { cover: coverRelPath } })
|
||||
this.update({ book: { cover: coverRelPath, coverFullPath: audioFileWithCover.fullPath } })
|
||||
return coverRelPath
|
||||
}
|
||||
return false
|
||||
|
@ -1022,5 +1022,23 @@ class Audiobook {
|
|||
existingOtherFileData
|
||||
}
|
||||
}
|
||||
|
||||
// Temp fix for cover is set but coverFullPath is not set
|
||||
fixFullCoverPath(metadataPath) {
|
||||
if (!this.book.cover) return
|
||||
var bookCoverPath = this.book.cover.replace(/\\/g, '/')
|
||||
var newFullCoverPath = null
|
||||
if (bookCoverPath.startsWith('/s/book/')) {
|
||||
newFullCoverPath = Path.join(this.fullPath, bookCoverPath.substr(`/s/book/${this.id}`.length)).replace(/\/\//g, '/')
|
||||
} else if (bookCoverPath.startsWith('/metadata/')) {
|
||||
newFullCoverPath = Path.join(metadataPath, bookCoverPath.substr('/metadata/'.length)).replace(/\/\//g, '/')
|
||||
}
|
||||
if (newFullCoverPath) {
|
||||
Logger.debug(`[Audiobook] "${this.title}" fixing full cover path "${this.book.cover}" => "${newFullCoverPath}"`)
|
||||
this.update({ book: { fullCoverPath: newFullCoverPath } })
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
module.exports = Audiobook
|
Loading…
Add table
Add a link
Reference in a new issue