mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-30 09:48:52 +01:00
Fix:Ensure podcast library item folder exists before downloading episodes #1019
This commit is contained in:
parent
1a4833f873
commit
6701551289
@ -4,6 +4,7 @@ const { getPodcastFeed } = require('../utils/podcastUtils')
|
|||||||
const Logger = require('../Logger')
|
const Logger = require('../Logger')
|
||||||
|
|
||||||
const { downloadFile, removeFile } = require('../utils/fileUtils')
|
const { downloadFile, removeFile } = require('../utils/fileUtils')
|
||||||
|
const filePerms = require('../utils/filePerms')
|
||||||
const { levenshteinDistance } = require('../utils/index')
|
const { levenshteinDistance } = require('../utils/index')
|
||||||
const opmlParser = require('../utils/parsers/parseOPML')
|
const opmlParser = require('../utils/parsers/parseOPML')
|
||||||
const prober = require('../utils/prober')
|
const prober = require('../utils/prober')
|
||||||
@ -72,6 +73,13 @@ class PodcastManager {
|
|||||||
// Ignores all added files to this dir
|
// Ignores all added files to this dir
|
||||||
this.watcher.addIgnoreDir(this.currentDownload.libraryItem.path)
|
this.watcher.addIgnoreDir(this.currentDownload.libraryItem.path)
|
||||||
|
|
||||||
|
// Make sure podcast library item folder exists
|
||||||
|
if (!(await fs.pathExists(this.currentDownload.libraryItem.path))) {
|
||||||
|
Logger.warn(`[PodcastManager] Podcast episode download: Podcast folder no longer exists at "${this.currentDownload.libraryItem.path}" - Creating it`)
|
||||||
|
await fs.mkdir(this.currentDownload.libraryItem.path)
|
||||||
|
await filePerms.setDefault(this.currentDownload.libraryItem.path)
|
||||||
|
}
|
||||||
|
|
||||||
var success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath).then(() => true).catch((error) => {
|
var success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath).then(() => true).catch((error) => {
|
||||||
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
|
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user