Add:Podcast iTunes search api and iTunes provider

This commit is contained in:
advplyr 2022-03-06 16:32:04 -06:00
parent 2a4cbd48b8
commit 43f48b65f8
7 changed files with 81 additions and 14 deletions

View file

@ -15,8 +15,9 @@ const CollectionController = require('./controllers/CollectionController')
const MeController = require('./controllers/MeController')
const BackupController = require('./controllers/BackupController')
const BookFinder = require('./BookFinder')
const AuthorFinder = require('./AuthorFinder')
const BookFinder = require('./finders/BookFinder')
const AuthorFinder = require('./finders/AuthorFinder')
const PodcastFinder = require('./finders/PodcastFinder')
const FileSystemController = require('./controllers/FileSystemController')
class ApiController {
@ -36,6 +37,7 @@ class ApiController {
this.bookFinder = new BookFinder()
this.authorFinder = new AuthorFinder()
this.podcastFinder = new PodcastFinder()
this.router = express()
this.init()
@ -131,6 +133,7 @@ class ApiController {
//
this.router.get('/search/covers', this.findCovers.bind(this))
this.router.get('/search/books', this.findBooks.bind(this))
this.router.get('/search/podcast', this.findPodcasts.bind(this))
//
// File System Routes
@ -181,6 +184,12 @@ class ApiController {
res.json(result)
}
async findPodcasts(req, res) {
var term = req.query.term
var results = await this.podcastFinder.search(term)
res.json(results)
}
authorize(req, res) {
if (!req.user) {
Logger.error('Invalid user in authorize')