mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-24 04:39:40 +00:00
Add: track manager sort by filename #128, Add: Support publish year wrapped in parenthesis, Change: Parse out CD Num from filename, Change: Show First Last author everywhere when Last, First is used in folder name, Fix: Re-Scan updates parsed track nums
This commit is contained in:
parent
b32b99418a
commit
92c2c53c09
10 changed files with 115 additions and 23 deletions
|
|
@ -206,9 +206,16 @@ function getAudiobookDataFromDir(folderPath, dir, parseSubtitle = false) {
|
|||
|
||||
|
||||
var publishYear = null
|
||||
// If Title is of format 1999 - Title, then use 1999 as publish year
|
||||
var publishYearMatch = title.match(/^([0-9]{4}) - (.+)/)
|
||||
if (publishYearMatch && publishYearMatch.length > 2) {
|
||||
// OLD regex (not matching parentheses)
|
||||
// var publishYearMatch = title.match(/^([0-9]{4}) - (.+)/)
|
||||
|
||||
// If Title is of format 1999 OR (1999) - Title, then use 1999 as publish year
|
||||
var publishYearMatch = title.match(/^(\(?[0-9]{4}\)?) - (.+)/)
|
||||
if (publishYearMatch && publishYearMatch.length > 2 && publishYearMatch[1]) {
|
||||
// Strip parentheses
|
||||
if (publishYearMatch[1].startsWith('(') && publishYearMatch[1].endsWith(')')) {
|
||||
publishYearMatch[1] = publishYearMatch[1].slice(1, -1)
|
||||
}
|
||||
if (!isNaN(publishYearMatch[1])) {
|
||||
publishYear = publishYearMatch[1]
|
||||
title = publishYearMatch[2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue