mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Update SearchController.js to respond with objects
Changes: - `findCovers` (GET /api/search/covers) - `findBooks` (GET /api/search/books) - `findPodcasts` (GET /api/search/podcast)
This commit is contained in:
parent
3fb2bd3362
commit
13532cba14
@ -7,8 +7,9 @@ class SearchController {
|
|||||||
var provider = req.query.provider || 'google'
|
var provider = req.query.provider || 'google'
|
||||||
var title = req.query.title || ''
|
var title = req.query.title || ''
|
||||||
var author = req.query.author || ''
|
var author = req.query.author || ''
|
||||||
var results = await this.bookFinder.search(provider, title, author)
|
res.json({
|
||||||
res.json(results)
|
results: await this.bookFinder.search(provider, title, author)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async findCovers(req, res) {
|
async findCovers(req, res) {
|
||||||
@ -23,13 +24,16 @@ class SearchController {
|
|||||||
var result = null
|
var result = null
|
||||||
if (podcast) result = await this.podcastFinder.findCovers(query.title)
|
if (podcast) result = await this.podcastFinder.findCovers(query.title)
|
||||||
else result = await this.bookFinder.findCovers(query.provider || 'google', query.title, query.author || null)
|
else result = await this.bookFinder.findCovers(query.provider || 'google', query.title, query.author || null)
|
||||||
res.json(result)
|
res.json({
|
||||||
|
results: result
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async findPodcasts(req, res) {
|
async findPodcasts(req, res) {
|
||||||
var term = req.query.term
|
var term = req.query.term
|
||||||
var results = await this.podcastFinder.search(term)
|
res.json({
|
||||||
res.json(results)
|
results: await this.podcastFinder.search(term)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async findAuthor(req, res) {
|
async findAuthor(req, res) {
|
||||||
|
Loading…
Reference in New Issue
Block a user