mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-29 04:00:32 +02:00
Add:Scanner extracts cover from comic files #1837 and ComicInfo.xml parser
This commit is contained in:
parent
e76af3bfc2
commit
f5545cd3f4
10 changed files with 762 additions and 4 deletions
35
server/utils/parsers/parseComicInfoMetadata.js
Normal file
35
server/utils/parsers/parseComicInfoMetadata.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
/**
|
||||
* TODO: Add more fields
|
||||
* @see https://anansi-project.github.io/docs/comicinfo/intro
|
||||
*
|
||||
* @param {Object} comicInfoJson
|
||||
* @returns {import('../../scanner/BookScanner').BookMetadataObject}
|
||||
*/
|
||||
module.exports.parse = (comicInfoJson) => {
|
||||
if (!comicInfoJson?.ComicInfo) return null
|
||||
|
||||
const ComicSeries = comicInfoJson.ComicInfo.Series?.[0]?.trim() || null
|
||||
const ComicNumber = comicInfoJson.ComicInfo.Number?.[0]?.trim() || null
|
||||
const ComicSummary = comicInfoJson.ComicInfo.Summary?.[0]?.trim() || null
|
||||
|
||||
let title = null
|
||||
const series = []
|
||||
if (ComicSeries) {
|
||||
series.push({
|
||||
name: ComicSeries,
|
||||
sequence: ComicNumber
|
||||
})
|
||||
|
||||
title = ComicSeries
|
||||
if (ComicNumber) {
|
||||
title += ` ${ComicNumber}`
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
series,
|
||||
description: ComicSummary
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue