Compare commits

..

No commits in common. "a41e9bae5dd8f6fd1d297e4ca1a2246ecedb755c" and "85d5531bc162eaa1a5a24fddb27b460cf320f5db" have entirely different histories.

2 changed files with 21 additions and 28 deletions

View file

@ -127,20 +127,10 @@ class PodcastManager {
})
let success = !!ffmpegDownloadResponse?.success
if (success) {
// Attempt to ffprobe and add podcast episode audio file
success = await this.scanAddPodcastEpisodeAudioFile()
if (!success) {
Logger.error(`[PodcastManager] Failed to scan and add podcast episode audio file - removing file`)
await fs.remove(this.currentDownload.targetPath)
}
}
// If failed due to ffmpeg or ffprobe error, retry without tagging
// If failed due to ffmpeg error, retry without tagging
// e.g. RSS feed may have incorrect file extension and file type
// See https://github.com/advplyr/audiobookshelf/issues/3837
// e.g. Ffmpeg may be download the file without streams causing the ffprobe to fail
if (!success && !ffmpegDownloadResponse?.isRequestError) {
if (!success && ffmpegDownloadResponse?.isFfmpegError) {
Logger.info(`[PodcastManager] Retrying episode download without tagging`)
// Download episode only
success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath)
@ -149,20 +139,23 @@ class PodcastManager {
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
return false
})
if (success) {
success = await this.scanAddPodcastEpisodeAudioFile()
if (!success) {
Logger.error(`[PodcastManager] Failed to scan and add podcast episode audio file - removing file`)
await fs.remove(this.currentDownload.targetPath)
}
}
}
if (success) {
Logger.info(`[PodcastManager] Successfully downloaded podcast episode "${this.currentDownload.episodeTitle}"`)
this.currentDownload.setFinished(true)
task.setFinished()
success = await this.scanAddPodcastEpisodeAudioFile()
if (!success) {
await fs.remove(this.currentDownload.targetPath)
this.currentDownload.setFinished(false)
const taskFailedString = {
text: 'Failed',
key: 'MessageTaskFailed'
}
task.setFailed(taskFailedString)
} else {
Logger.info(`[PodcastManager] Successfully downloaded podcast episode "${this.currentDownload.episodeTitle}"`)
this.currentDownload.setFinished(true)
task.setFinished()
}
} else {
const taskFailedString = {
text: 'Failed',

View file

@ -99,7 +99,7 @@ module.exports.resizeImage = resizeImage
/**
*
* @param {import('../objects/PodcastEpisodeDownload')} podcastEpisodeDownload
* @returns {Promise<{success: boolean, isRequestError?: boolean}>}
* @returns {Promise<{success: boolean, isFfmpegError?: boolean}>}
*/
module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
return new Promise(async (resolve) => {
@ -118,7 +118,7 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
method: 'GET',
responseType: 'stream',
headers: {
Accept: '*/*',
'Accept': '*/*',
'User-Agent': userAgent
},
timeout: global.PodcastDownloadTimeout
@ -139,8 +139,7 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
if (!response) {
return resolve({
success: false,
isRequestError: true
success: false
})
}
@ -205,7 +204,8 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
Logger.error(`Full stderr dump for episode url "${podcastEpisodeDownload.url}": ${stderrLines.join('\n')}`)
}
resolve({
success: false
success: false,
isFfmpegError: true
})
})
ffmpeg.on('progress', (progress) => {