Change:Server setting for coverDestination to storeCoverWithBook boolean, Add:abmetadata generator

This commit is contained in:
advplyr 2022-02-27 12:47:56 -06:00
parent 4e7d2ddc58
commit eb109c398f
9 changed files with 33 additions and 51 deletions

View file

@ -20,13 +20,24 @@ const bookKeyMap = {
}
function generate(audiobook, outputPath, uid, gid) {
var fileString = `[audiobookshelf v${package.version}]\n`
var fileString = ';ABMETADATA1\n'
fileString += `#audiobookshelf v${package.version}\n\n`
for (const key in bookKeyMap) {
const value = audiobook.book[bookKeyMap[key]] || ''
fileString += `${key}=${value}\n`
}
if (audiobook.chapters.length) {
fileString += '\n'
audiobook.chapters.forEach((chapter) => {
fileString += `[CHAPTER]\n`
fileString += `start=${chapter.start}\n`
fileString += `end=${chapter.end}\n`
fileString += `title=${chapter.title}\n`
})
}
return fs.writeFile(outputPath, fileString).then(() => {
return filePerms(outputPath, 0o774, uid, gid).then(() => true)
}).catch((error) => {

View file

@ -6,11 +6,6 @@ module.exports.ScanResult = {
UPTODATE: 4
}
module.exports.CoverDestination = {
METADATA: 0,
AUDIOBOOK: 1
}
module.exports.BookCoverAspectRatio = {
STANDARD: 0, // 1.6:1
SQUARE: 1