mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 09:51:37 +00:00
Compare commits
No commits in common. "a89a24e48e17d79c0d217397d8aad00f0ba336a0" and "fd4932cdbb6d6939c2ff768b381cccd69233dcdc" have entirely different histories.
a89a24e48e
...
fd4932cdbb
2 changed files with 31 additions and 10 deletions
|
|
@ -121,17 +121,28 @@ class PodcastManager {
|
||||||
await fs.mkdir(this.currentDownload.libraryItem.path)
|
await fs.mkdir(this.currentDownload.libraryItem.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download episode and tag it
|
let success = false
|
||||||
const ffmpegDownloadResponse = await ffmpegHelpers.downloadPodcastEpisode(this.currentDownload).catch((error) => {
|
if (this.currentDownload.isMp3) {
|
||||||
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
|
// Download episode and tag it
|
||||||
})
|
const ffmpegDownloadResponse = await ffmpegHelpers.downloadPodcastEpisode(this.currentDownload).catch((error) => {
|
||||||
let success = !!ffmpegDownloadResponse?.success
|
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
|
||||||
|
})
|
||||||
|
success = !!ffmpegDownloadResponse?.success
|
||||||
|
|
||||||
// If failed due to ffmpeg 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
|
// e.g. RSS feed may have incorrect file extension and file type
|
||||||
// See https://github.com/advplyr/audiobookshelf/issues/3837
|
// See https://github.com/advplyr/audiobookshelf/issues/3837
|
||||||
if (!success && ffmpegDownloadResponse?.isFfmpegError) {
|
if (!success && ffmpegDownloadResponse?.isFfmpegError) {
|
||||||
Logger.info(`[PodcastManager] Retrying episode download without tagging`)
|
Logger.info(`[PodcastManager] Retrying episode download without tagging`)
|
||||||
|
// Download episode only
|
||||||
|
success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath)
|
||||||
|
.then(() => true)
|
||||||
|
.catch((error) => {
|
||||||
|
Logger.error(`[PodcastManager] Podcast Episode download failed`, error)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// Download episode only
|
// Download episode only
|
||||||
success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath)
|
success = await downloadFile(this.currentDownload.url, this.currentDownload.targetPath)
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,16 @@ class PodcastEpisodeDownload {
|
||||||
const enclosureType = this.rssPodcastEpisode.enclosure.type
|
const enclosureType = this.rssPodcastEpisode.enclosure.type
|
||||||
return typeof enclosureType === 'string' ? enclosureType : null
|
return typeof enclosureType === 'string' ? enclosureType : null
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* RSS feed may have an episode with file extension of mp3 but the specified enclosure type is not mpeg.
|
||||||
|
* @see https://github.com/advplyr/audiobookshelf/issues/3711
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
get isMp3() {
|
||||||
|
if (this.enclosureType && !this.enclosureType.includes('mpeg')) return false
|
||||||
|
return this.fileExtension === 'mp3'
|
||||||
|
}
|
||||||
get episodeTitle() {
|
get episodeTitle() {
|
||||||
return this.rssPodcastEpisode.title
|
return this.rssPodcastEpisode.title
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue