mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Merge version bump 1.6.35
This commit is contained in:
commit
f6d43ea60f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "audiobookshelf-client",
|
"name": "audiobookshelf-client",
|
||||||
"version": "1.6.34",
|
"version": "1.6.35",
|
||||||
"description": "Audiobook manager and player",
|
"description": "Audiobook manager and player",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "audiobookshelf",
|
"name": "audiobookshelf",
|
||||||
"version": "1.6.34",
|
"version": "1.6.35",
|
||||||
"description": "Self-hosted audiobook server for managing and playing audiobooks",
|
"description": "Self-hosted audiobook server for managing and playing audiobooks",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -173,7 +173,7 @@ class LibraryController {
|
|||||||
series = series.slice(startIndex, startIndex + payload.limit)
|
series = series.slice(startIndex, startIndex + payload.limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.results = series
|
payload.results = sort(series).asc(s => s.name)
|
||||||
res.json(payload)
|
res.json(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const { xmlToJSON } = require('./index')
|
const { xmlToJSON } = require('./index')
|
||||||
|
const { stripHtml } = require("string-strip-html")
|
||||||
|
|
||||||
function parseCreators(metadata) {
|
function parseCreators(metadata) {
|
||||||
if (!metadata['dc:creator']) return null
|
if (!metadata['dc:creator']) return null
|
||||||
@ -56,7 +57,7 @@ function fetchDescription(metadata) {
|
|||||||
// check if description is HTML or plain text. only plain text allowed
|
// check if description is HTML or plain text. only plain text allowed
|
||||||
// calibre stores < and > as < and >
|
// calibre stores < and > as < and >
|
||||||
description = description.replace(/</g, '<').replace(/>/g, '>')
|
description = description.replace(/</g, '<').replace(/>/g, '>')
|
||||||
if (description.match(/<!DOCTYPE html>|<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a-f\d]+);)/)) return null
|
if (description.match(/<!DOCTYPE html>|<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a-f\d]+);)/)) return stripHtml(description).result
|
||||||
return description
|
return description
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +70,16 @@ function fetchLanguage(metadata) {
|
|||||||
return fetchTagString(metadata, 'dc:language')
|
return fetchTagString(metadata, 'dc:language')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fetchSeries(metadata) {
|
||||||
|
if(typeof metadata.meta == "undefined") return null
|
||||||
|
return fetchTagString(metadata.meta, "calibre:series")
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchVolumeNumber(metadata) {
|
||||||
|
if(typeof metadata.meta == "undefined") return null
|
||||||
|
return fetchTagString(metadata.meta, "calibre:series_index")
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.parseOpfMetadataXML = async (xml) => {
|
module.exports.parseOpfMetadataXML = async (xml) => {
|
||||||
var json = await xmlToJSON(xml)
|
var json = await xmlToJSON(xml)
|
||||||
if (!json || !json.package || !json.package.metadata) return null
|
if (!json || !json.package || !json.package.metadata) return null
|
||||||
@ -79,6 +90,13 @@ module.exports.parseOpfMetadataXML = async (xml) => {
|
|||||||
metadata = metadata[0]
|
metadata = metadata[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof metadata.meta != "undefined") {
|
||||||
|
metadata.meta = {}
|
||||||
|
for(var match of xml.matchAll(/<meta name="(?<name>.+)" content="(?<content>.+)"\/>/g)) {
|
||||||
|
metadata.meta[match.groups['name']] = [match.groups['content']]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var creators = parseCreators(metadata)
|
var creators = parseCreators(metadata)
|
||||||
var data = {
|
var data = {
|
||||||
title: fetchTitle(metadata),
|
title: fetchTitle(metadata),
|
||||||
@ -89,7 +107,9 @@ module.exports.parseOpfMetadataXML = async (xml) => {
|
|||||||
isbn: fetchISBN(metadata),
|
isbn: fetchISBN(metadata),
|
||||||
description: fetchDescription(metadata),
|
description: fetchDescription(metadata),
|
||||||
genres: fetchGenres(metadata),
|
genres: fetchGenres(metadata),
|
||||||
language: fetchLanguage(metadata)
|
language: fetchLanguage(metadata),
|
||||||
|
series: fetchSeries(metadata),
|
||||||
|
volumeNumber: fetchVolumeNumber(metadata)
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user