File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ const LibraryItem = require('../objects/LibraryItem')
25
25
26
26
class PodcastManager {
27
27
constructor ( ) {
28
+ /** @type {PodcastEpisodeDownload[] } */
28
29
this . downloadQueue = [ ]
30
+ /** @type {PodcastEpisodeDownload } */
29
31
this . currentDownload = null
30
32
31
33
this . failedCheckMap = { }
@@ -63,6 +65,11 @@ class PodcastManager {
63
65
}
64
66
}
65
67
68
+ /**
69
+ *
70
+ * @param {PodcastEpisodeDownload } podcastEpisodeDownload
71
+ * @returns
72
+ */
66
73
async startPodcastEpisodeDownload ( podcastEpisodeDownload ) {
67
74
if ( this . currentDownload ) {
68
75
this . downloadQueue . push ( podcastEpisodeDownload )
@@ -106,7 +113,7 @@ class PodcastManager {
106
113
}
107
114
108
115
let success = false
109
- if ( this . currentDownload . urlFileExtension === 'mp3' ) {
116
+ if ( this . currentDownload . isMp3 ) {
110
117
// Download episode and tag it
111
118
success = await ffmpegHelpers . downloadPodcastEpisode ( this . currentDownload ) . catch ( ( error ) => {
112
119
Logger . error ( `[PodcastManager] Podcast Episode download failed` , error )
Original file line number Diff line number Diff line change @@ -53,6 +53,20 @@ class PodcastEpisodeDownload {
53
53
if ( globals . SupportedAudioTypes . includes ( extname ) ) return extname
54
54
return 'mp3'
55
55
}
56
+ get enclosureType ( ) {
57
+ const enclosureType = this . podcastEpisode ?. enclosure ?. type
58
+ return typeof enclosureType === 'string' ? enclosureType : null
59
+ }
60
+ /**
61
+ * RSS feed may have an episode with file extension of mp3 but the specified enclosure type is not mpeg.
62
+ * @see https://github.com/advplyr/audiobookshelf/issues/3711
63
+ *
64
+ * @returns {boolean }
65
+ */
66
+ get isMp3 ( ) {
67
+ if ( this . enclosureType && ! this . enclosureType . includes ( 'mpeg' ) ) return false
68
+ return this . fileExtension === 'mp3'
69
+ }
56
70
57
71
get targetFilename ( ) {
58
72
const appendage = this . appendEpisodeId ? ` (${ this . podcastEpisode . id } )` : ''
You can’t perform that action at this time.
0 commit comments