Merge pull request #1906 from warnwar/master

stop opf importer from adding duplicate info
This commit is contained in:
advplyr 2023-07-15 11:44:41 -05:00 committed by GitHub
commit 9439acf300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ function parseCreators(metadata) {
function fetchCreators(creators, role) { function fetchCreators(creators, role) {
if (!creators || !creators.length) return null if (!creators || !creators.length) return null
return creators.filter(c => c.role === role).map(c => c.value) return [...new Set(creators.filter(c => c.role === role).map(c => c.value))]
} }
function fetchTagString(metadata, tag) { function fetchTagString(metadata, tag) {
@ -92,7 +92,7 @@ function fetchDescription(metadata) {
function fetchGenres(metadata) { function fetchGenres(metadata) {
if (!metadata['dc:subject'] || !metadata['dc:subject'].length) return [] if (!metadata['dc:subject'] || !metadata['dc:subject'].length) return []
return metadata['dc:subject'].map(g => typeof g === 'string' ? g : null).filter(g => !!g) return [...new Set(metadata['dc:subject'].filter(g => typeof g === 'string'))]
} }
function fetchLanguage(metadata) { function fetchLanguage(metadata) {
@ -122,7 +122,7 @@ function fetchNarrators(creators, metadata) {
function fetchTags(metadata) { function fetchTags(metadata) {
if (!metadata['dc:tag'] || !metadata['dc:tag'].length) return [] if (!metadata['dc:tag'] || !metadata['dc:tag'].length) return []
return metadata['dc:tag'].filter(tag => (typeof tag === 'string')) return [...new Set(metadata['dc:tag'].filter(tag => typeof tag === 'string'))]
} }
function stripPrefix(str) { function stripPrefix(str) {