mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
feat: parse language from NFO metadata source
This commit is contained in:
parent
37ad1cced2
commit
9a697f48db
@ -38,6 +38,10 @@ class NfoFileScanner {
|
||||
sequence: nfoMetadata.sequence || null
|
||||
}]
|
||||
}
|
||||
} else if (key === 'language') {
|
||||
if (nfoMetadata.language) {
|
||||
bookMetadata.language = nfoMetadata.language
|
||||
}
|
||||
} else if (nfoMetadata[key] && key !== 'sequence') {
|
||||
bookMetadata[key] = nfoMetadata[key]
|
||||
}
|
||||
|
@ -81,6 +81,10 @@ function parseNfoMetadata(nfoText) {
|
||||
case 'isbn-13':
|
||||
metadata.isbn = value
|
||||
break
|
||||
case 'language':
|
||||
case 'lang':
|
||||
metadata.language = value
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -103,6 +103,16 @@ describe('parseNfoMetadata', () => {
|
||||
expect(result.asin).to.equal('B08X5JZJLH')
|
||||
})
|
||||
|
||||
it('parses language', () => {
|
||||
const nfoText = 'Language: eng'
|
||||
const result = parseNfoMetadata(nfoText)
|
||||
expect(result.language).to.equal('eng')
|
||||
|
||||
const nfoText2 = 'lang: deu'
|
||||
const result2 = parseNfoMetadata(nfoText2)
|
||||
expect(result2.language).to.equal('deu')
|
||||
})
|
||||
|
||||
it('parses description', () => {
|
||||
const nfoText = 'Book Description\n=========\nThis is a book.\n It\'s good'
|
||||
const result = parseNfoMetadata(nfoText)
|
||||
|
Loading…
Reference in New Issue
Block a user