mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-24 14:37:14 -04:00
Fix scan for audiobook directories in root dir
This commit is contained in:
parent
f4cb5d101e
commit
73a786879e
11 changed files with 157 additions and 11 deletions
|
@ -2,11 +2,12 @@ const express = require('express')
|
|||
const Logger = require('./Logger')
|
||||
|
||||
class ApiController {
|
||||
constructor(db, scanner, auth, streamManager, emitter) {
|
||||
constructor(db, scanner, auth, streamManager, rssFeeds, emitter) {
|
||||
this.db = db
|
||||
this.scanner = scanner
|
||||
this.auth = auth
|
||||
this.streamManager = streamManager
|
||||
this.rssFeeds = rssFeeds
|
||||
this.emitter = emitter
|
||||
|
||||
this.router = express()
|
||||
|
@ -35,6 +36,8 @@ class ApiController {
|
|||
this.router.post('/authorize', this.authorize.bind(this))
|
||||
|
||||
this.router.get('/genres', this.getGenres.bind(this))
|
||||
|
||||
this.router.post('/feed', this.openRssFeed.bind(this))
|
||||
}
|
||||
|
||||
find(req, res) {
|
||||
|
@ -42,7 +45,6 @@ class ApiController {
|
|||
}
|
||||
|
||||
findCovers(req, res) {
|
||||
console.log('Find covers', req.query)
|
||||
this.scanner.findCovers(req, res)
|
||||
}
|
||||
|
||||
|
@ -174,6 +176,15 @@ class ApiController {
|
|||
this.auth.userChangePassword(req, res)
|
||||
}
|
||||
|
||||
async openRssFeed(req, res) {
|
||||
var audiobookId = req.body.audiobookId
|
||||
var audiobook = this.db.audiobooks.find(ab => ab.id === audiobookId)
|
||||
if (!audiobook) return res.sendStatus(404)
|
||||
var feed = await this.rssFeeds.openFeed(audiobook)
|
||||
console.log('Feed open', feed)
|
||||
res.json(feed)
|
||||
}
|
||||
|
||||
getGenres(req, res) {
|
||||
res.json({
|
||||
genres: this.db.getGenres()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue