mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 18:24:46 +02:00
Series as a dropdown and filter, fix genre list in details modal
This commit is contained in:
parent
0990c61c93
commit
dd213ddfd1
11 changed files with 310 additions and 65 deletions
|
@ -23,4 +23,21 @@ const levenshteinDistance = (str1, str2, caseSensitive = false) => {
|
|||
}
|
||||
return track[str2.length][str1.length];
|
||||
}
|
||||
module.exports.levenshteinDistance = levenshteinDistance
|
||||
module.exports.levenshteinDistance = levenshteinDistance
|
||||
|
||||
const cleanString = (str) => {
|
||||
if (!str) return ''
|
||||
|
||||
// replace accented characters: https://stackoverflow.com/a/49901740/7431543
|
||||
str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
|
||||
|
||||
const availableChars = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
||||
const cleanChar = (char) => availableChars.indexOf(char) < 0 ? '?' : char
|
||||
|
||||
var cleaned = ''
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
cleaned += cleanChar(str[i])
|
||||
}
|
||||
return cleaned
|
||||
}
|
||||
module.exports.cleanString = cleanString
|
|
@ -1,6 +1,7 @@
|
|||
const Path = require('path')
|
||||
const dir = require('node-dir')
|
||||
const Logger = require('../Logger')
|
||||
const { cleanString } = require('./index')
|
||||
|
||||
const AUDIOBOOK_PARTS_FORMATS = ['m4b', 'mp3']
|
||||
const INFO_FORMATS = ['nfo']
|
||||
|
@ -64,7 +65,7 @@ async function getAllAudiobookFiles(abRootPath) {
|
|||
audiobooks[path] = {
|
||||
author: author,
|
||||
title: title,
|
||||
series: series,
|
||||
series: cleanString(series),
|
||||
publishYear: publishYear,
|
||||
path: relpath,
|
||||
fullPath: Path.join(abRootPath, path),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue