Series as a dropdown and filter, fix genre list in details modal

This commit is contained in:
Mark Cooper 2021-08-22 08:52:37 -05:00
parent 0990c61c93
commit dd213ddfd1
11 changed files with 310 additions and 65 deletions

View file

@ -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

View file

@ -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),