mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-01 08:44:40 +02:00
Fix:Download podcast episodes that are not mp3 #1513
This commit is contained in:
parent
ebad304aa9
commit
387a37e4da
1 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
const Path = require('path')
|
const Path = require('path')
|
||||||
const { getId } = require('../utils/index')
|
const { getId } = require('../utils/index')
|
||||||
const { sanitizeFilename } = require('../utils/fileUtils')
|
const { sanitizeFilename } = require('../utils/fileUtils')
|
||||||
|
const globals = require('../utils/globals')
|
||||||
|
|
||||||
class PodcastEpisodeDownload {
|
class PodcastEpisodeDownload {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -40,8 +41,14 @@ class PodcastEpisodeDownload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get fileExtension() {
|
||||||
|
const extname = Path.extname(this.url).substring(1).toLowerCase()
|
||||||
|
if (globals.SupportedAudioTypes.includes(extname)) return extname
|
||||||
|
return 'mp3'
|
||||||
|
}
|
||||||
|
|
||||||
get targetFilename() {
|
get targetFilename() {
|
||||||
return sanitizeFilename(`${this.podcastEpisode.title}.mp3`)
|
return sanitizeFilename(`${this.podcastEpisode.title}.${this.fileExtension}`)
|
||||||
}
|
}
|
||||||
get targetPath() {
|
get targetPath() {
|
||||||
return Path.join(this.libraryItem.path, this.targetFilename)
|
return Path.join(this.libraryItem.path, this.targetFilename)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue