mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-10-04 11:19:29 +02:00
Add "Best" option to book cover search
This commit is contained in:
parent
dbb5ee79ac
commit
20de2ea388
@ -134,7 +134,7 @@ export default {
|
|||||||
},
|
},
|
||||||
providers() {
|
providers() {
|
||||||
if (this.isPodcast) return this.$store.state.scanners.podcastProviders
|
if (this.isPodcast) return this.$store.state.scanners.podcastProviders
|
||||||
return [{ text: 'All', value: 'all' }, ...this.$store.state.scanners.providers, ...this.$store.state.scanners.coverOnlyProviders]
|
return [{ text: 'Best', value: 'best' }, ...this.$store.state.scanners.providers, ...this.$store.state.scanners.coverOnlyProviders, { text: 'All', value: 'all' }]
|
||||||
},
|
},
|
||||||
searchTitleLabel() {
|
searchTitleLabel() {
|
||||||
if (this.provider.startsWith('audible')) return this.$strings.LabelSearchTitleOrASIN
|
if (this.provider.startsWith('audible')) return this.$strings.LabelSearchTitleOrASIN
|
||||||
@ -243,7 +243,19 @@ export default {
|
|||||||
this.searchTitle = this.mediaMetadata.title || ''
|
this.searchTitle = this.mediaMetadata.title || ''
|
||||||
this.searchAuthor = this.mediaMetadata.authorName || ''
|
this.searchAuthor = this.mediaMetadata.authorName || ''
|
||||||
if (this.isPodcast) this.provider = 'itunes'
|
if (this.isPodcast) this.provider = 'itunes'
|
||||||
else this.provider = localStorage.getItem('book-cover-provider') || localStorage.getItem('book-provider') || 'google'
|
else {
|
||||||
|
// Migrate from 'all' to 'best' (only once)
|
||||||
|
const migrationKey = 'book-cover-provider-migrated'
|
||||||
|
const currentProvider = localStorage.getItem('book-cover-provider') || localStorage.getItem('book-provider') || 'google'
|
||||||
|
|
||||||
|
if (!localStorage.getItem(migrationKey) && currentProvider === 'all') {
|
||||||
|
localStorage.setItem('book-cover-provider', 'best')
|
||||||
|
localStorage.setItem(migrationKey, 'true')
|
||||||
|
this.provider = 'best'
|
||||||
|
} else {
|
||||||
|
this.provider = currentProvider
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeCover() {
|
removeCover() {
|
||||||
if (!this.coverPath) {
|
if (!this.coverPath) {
|
||||||
|
@ -608,6 +608,14 @@ class BookFinder {
|
|||||||
Logger.debug(`[BookFinder] Found ${providerResults.length} covers from ${providerString}`)
|
Logger.debug(`[BookFinder] Found ${providerResults.length} covers from ${providerString}`)
|
||||||
searchResults.push(...providerResults)
|
searchResults.push(...providerResults)
|
||||||
}
|
}
|
||||||
|
} else if (provider === 'best') {
|
||||||
|
// Best providers: google, fantlab, and audible.com
|
||||||
|
const bestProviders = ['google', 'fantlab', 'audible']
|
||||||
|
for (const providerString of bestProviders) {
|
||||||
|
const providerResults = await this.search(null, providerString, title, author, options)
|
||||||
|
Logger.debug(`[BookFinder] Found ${providerResults.length} covers from ${providerString}`)
|
||||||
|
searchResults.push(...providerResults)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
searchResults = await this.search(null, provider, title, author, options)
|
searchResults = await this.search(null, provider, title, author, options)
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,9 @@ class CoverSearchManager {
|
|||||||
|
|
||||||
if (provider === 'all') {
|
if (provider === 'all') {
|
||||||
providers = [...BookFinder.providers]
|
providers = [...BookFinder.providers]
|
||||||
|
} else if (provider === 'best') {
|
||||||
|
// Best providers: google, fantlab, and audible.com
|
||||||
|
providers = ['google', 'fantlab', 'audible']
|
||||||
} else {
|
} else {
|
||||||
providers = [provider]
|
providers = [provider]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user