mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-15 13:51:35 +00:00
Trim whitespace in certain string fields for better overview
Fixed ASIN-Search fixes #2605
This commit is contained in:
parent
ce7f81d676
commit
3b2b72c6da
5 changed files with 7 additions and 5 deletions
|
|
@ -451,6 +451,7 @@ class BookFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
findChapters(asin, region) {
|
findChapters(asin, region) {
|
||||||
|
asin = asin.trim()
|
||||||
return this.audnexus.getChaptersByASIN(asin, region)
|
return this.audnexus.getChaptersByASIN(asin, region)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class Author extends Model {
|
||||||
return new oldAuthor({
|
return new oldAuthor({
|
||||||
id: this.id,
|
id: this.id,
|
||||||
asin: this.asin,
|
asin: this.asin,
|
||||||
name: this.name,
|
name: this.name.trim(),
|
||||||
description: this.description,
|
description: this.description,
|
||||||
imagePath: this.imagePath,
|
imagePath: this.imagePath,
|
||||||
libraryId: this.libraryId,
|
libraryId: this.libraryId,
|
||||||
|
|
@ -66,7 +66,7 @@ class Author extends Model {
|
||||||
static getFromOld(oldAuthor) {
|
static getFromOld(oldAuthor) {
|
||||||
return {
|
return {
|
||||||
id: oldAuthor.id,
|
id: oldAuthor.id,
|
||||||
name: oldAuthor.name,
|
name: oldAuthor.name.trim(),
|
||||||
lastFirst: oldAuthor.lastFirst,
|
lastFirst: oldAuthor.lastFirst,
|
||||||
asin: oldAuthor.asin,
|
asin: oldAuthor.asin,
|
||||||
description: oldAuthor.description,
|
description: oldAuthor.description,
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ class Book extends Model {
|
||||||
chapters: this.chapters?.map(c => ({ ...c })) || [],
|
chapters: this.chapters?.map(c => ({ ...c })) || [],
|
||||||
title: this.title,
|
title: this.title,
|
||||||
subtitle: this.subtitle,
|
subtitle: this.subtitle,
|
||||||
authors: this.authors.map(a => a.name),
|
authors: this.authors.map(a => a.name.trim()),
|
||||||
narrators: this.narrators,
|
narrators: this.narrators,
|
||||||
series: this.series.map(se => {
|
series: this.series.map(se => {
|
||||||
const sequence = se.bookSeries?.sequence || ''
|
const sequence = se.bookSeries?.sequence || ''
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,8 @@ class LibraryItem extends Model {
|
||||||
for (const key in updatedMedia) {
|
for (const key in updatedMedia) {
|
||||||
let existingValue = libraryItemExpanded.media[key]
|
let existingValue = libraryItemExpanded.media[key]
|
||||||
if (existingValue instanceof Date) existingValue = existingValue.valueOf()
|
if (existingValue instanceof Date) existingValue = existingValue.valueOf()
|
||||||
|
// Check for trimming. Why not instanceof? var str = "string" isn't instance of String
|
||||||
|
if (typeof updatedMedia[key] === "string") updatedMedia[key] = updatedMedia[key].trim()
|
||||||
if (!areEquivalent(updatedMedia[key], existingValue, true)) {
|
if (!areEquivalent(updatedMedia[key], existingValue, true)) {
|
||||||
Logger.debug(`[LibraryItem] "${libraryItemExpanded.media.title}" ${libraryItemExpanded.mediaType}.${key} updated from ${existingValue} to ${updatedMedia[key]}`)
|
Logger.debug(`[LibraryItem] "${libraryItemExpanded.media.title}" ${libraryItemExpanded.mediaType}.${key} updated from ${existingValue} to ${updatedMedia[key]}`)
|
||||||
hasMediaUpdates = true
|
hasMediaUpdates = true
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class Series extends Model {
|
||||||
getOldSeries() {
|
getOldSeries() {
|
||||||
return new oldSeries({
|
return new oldSeries({
|
||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name.trim(),
|
||||||
description: this.description,
|
description: this.description,
|
||||||
libraryId: this.libraryId,
|
libraryId: this.libraryId,
|
||||||
addedAt: this.createdAt.valueOf(),
|
addedAt: this.createdAt.valueOf(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue