mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Update:Select largest cover image from Google Books provider #1244
This commit is contained in:
parent
4fcdeda447
commit
a68ade2b3d
@ -15,7 +15,13 @@ class GoogleBooks {
|
|||||||
cleanResult(item) {
|
cleanResult(item) {
|
||||||
var { id, volumeInfo } = item
|
var { id, volumeInfo } = item
|
||||||
if (!volumeInfo) return null
|
if (!volumeInfo) return null
|
||||||
var { title, subtitle, authors, publisher, publisherDate, description, industryIdentifiers, categories, imageLinks } = volumeInfo
|
const { title, subtitle, authors, publisher, publisherDate, description, industryIdentifiers, categories, imageLinks } = volumeInfo
|
||||||
|
|
||||||
|
let cover = null
|
||||||
|
// Selects the largest cover assuming the largest is the last key in the object
|
||||||
|
if (imageLinks && Object.keys(imageLinks).length) {
|
||||||
|
cover = imageLinks[Object.keys(imageLinks).pop()] || null
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
@ -25,7 +31,7 @@ class GoogleBooks {
|
|||||||
publisher,
|
publisher,
|
||||||
publishedYear: publisherDate ? publisherDate.split('-')[0] : null,
|
publishedYear: publisherDate ? publisherDate.split('-')[0] : null,
|
||||||
description,
|
description,
|
||||||
cover: imageLinks && imageLinks.thumbnail ? imageLinks.thumbnail : null,
|
cover,
|
||||||
genres: categories && Array.isArray(categories) ? [...categories] : null,
|
genres: categories && Array.isArray(categories) ? [...categories] : null,
|
||||||
isbn: this.extractIsbn(industryIdentifiers)
|
isbn: this.extractIsbn(industryIdentifiers)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user