mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-23 04:09:38 +00:00
Book tags genres dedupe (#4927)
* Update Audible provider dedupe genres/tags and return tags as array * Update custom metadata provider to dedupe tags/genres and return tags as array
This commit is contained in:
parent
088353ae26
commit
7b37c98e88
2 changed files with 32 additions and 6 deletions
|
|
@ -57,8 +57,13 @@ class Audible {
|
|||
})
|
||||
}
|
||||
|
||||
const genresFiltered = genres ? genres.filter((g) => g.type == 'genre').map((g) => g.name) : []
|
||||
const tagsFiltered = genres ? genres.filter((g) => g.type == 'tag').map((g) => g.name) : []
|
||||
let genresCleaned = null
|
||||
let tagsCleaned = null
|
||||
|
||||
if (genres && Array.isArray(genres)) {
|
||||
genresCleaned = [...new Set(genres.filter((g) => g.type == 'genre').map((g) => g.name))]
|
||||
tagsCleaned = [...new Set(genres.filter((g) => g.type == 'tag').map((g) => g.name))]
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
|
|
@ -71,8 +76,8 @@ class Audible {
|
|||
cover: image,
|
||||
asin,
|
||||
isbn,
|
||||
genres: genresFiltered.length ? genresFiltered : null,
|
||||
tags: tagsFiltered.length ? tagsFiltered.join(', ') : null,
|
||||
genres: genresCleaned.length ? genresCleaned : null,
|
||||
tags: tagsCleaned.length ? tagsCleaned : null,
|
||||
series: series.length ? series : null,
|
||||
language: language ? language.charAt(0).toUpperCase() + language.slice(1) : null,
|
||||
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue