mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Fix:Parsing authors from meta tags removes duplicates #1932
This commit is contained in:
parent
7fdf1a1d7f
commit
3f380b0839
@ -86,13 +86,10 @@ module.exports.parse = (nameString) => {
|
|||||||
// Filter out names that have no first and last
|
// Filter out names that have no first and last
|
||||||
names = names.filter(n => n.first_name || n.last_name)
|
names = names.filter(n => n.first_name || n.last_name)
|
||||||
|
|
||||||
var namesArray = names.map(a => a.first_name ? `${a.first_name} ${a.last_name}` : a.last_name)
|
// Set name strings and remove duplicates
|
||||||
var firstLast = names.length ? namesArray.join(', ') : ''
|
const namesArray = [...new Set(names.map(a => a.first_name ? `${a.first_name} ${a.last_name}` : a.last_name))]
|
||||||
var lastFirst = names.length ? names.map(a => a.first_name ? `${a.last_name}, ${a.first_name}` : a.last_name).join(', ') : ''
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nameFL: firstLast, // String of comma separated first last
|
|
||||||
nameLF: lastFirst, // String of comma separated last, first
|
|
||||||
names: namesArray // Array of first last
|
names: namesArray // Array of first last
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user