mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-31 00:05:27 +02:00
New model update details, author and series inputs with create new, compare & copy utils
This commit is contained in:
parent
f2be3bc95e
commit
5f4e5cd3d8
19 changed files with 707 additions and 70 deletions
|
@ -2,6 +2,7 @@ const Path = require('path')
|
|||
const fs = require('fs')
|
||||
const Logger = require('../Logger')
|
||||
const { parseString } = require("xml2js")
|
||||
const areEquivalent = require('./areEquivalent')
|
||||
|
||||
const levenshteinDistance = (str1, str2, caseSensitive = false) => {
|
||||
if (!caseSensitive) {
|
||||
|
@ -99,4 +100,21 @@ module.exports.msToTimestamp = (ms, includeMs) => secondsToTimestamp(ms / 1000,
|
|||
module.exports.reqSupportsWebp = (req) => {
|
||||
if (!req || !req.headers || !req.headers.accept) return false
|
||||
return req.headers.accept.includes('image/webp') || req.headers.accept === '*/*'
|
||||
}
|
||||
|
||||
module.exports.areEquivalent = areEquivalent
|
||||
|
||||
module.exports.copyValue = (val) => {
|
||||
if (!val) return null
|
||||
if (!this.isObject(val)) return val
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return val.map(this.copyValue)
|
||||
} else {
|
||||
var final = {}
|
||||
for (const key in val) {
|
||||
final[key] = this.copyValue(val[key])
|
||||
}
|
||||
return final
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue