mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Merge branch 'master' into sqlite
This commit is contained in:
commit
8287822354
@ -1,6 +1,6 @@
|
|||||||
const SupportedFileTypes = {
|
const SupportedFileTypes = {
|
||||||
image: ['png', 'jpg', 'jpeg', 'webp'],
|
image: ['png', 'jpg', 'jpeg', 'webp'],
|
||||||
audio: ['m4b', 'mp3', 'm4a', 'flac', 'opus', 'ogg', 'oga', 'mp4', 'aac', 'wma', 'aiff', 'wav', 'webm', 'webma', 'mka'],
|
audio: ['m4b', 'mp3', 'm4a', 'flac', 'opus', 'ogg', 'oga', 'mp4', 'aac', 'wma', 'aiff', 'wav', 'webm', 'webma', 'mka', 'awb'],
|
||||||
ebook: ['epub', 'pdf', 'mobi', 'azw3', 'cbr', 'cbz'],
|
ebook: ['epub', 'pdf', 'mobi', 'azw3', 'cbr', 'cbz'],
|
||||||
info: ['nfo'],
|
info: ['nfo'],
|
||||||
text: ['txt'],
|
text: ['txt'],
|
||||||
|
@ -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)
|
||||||
|
@ -82,7 +82,8 @@ class Stream extends EventEmitter {
|
|||||||
AudioMimeType.WMA,
|
AudioMimeType.WMA,
|
||||||
AudioMimeType.AIFF,
|
AudioMimeType.AIFF,
|
||||||
AudioMimeType.WEBM,
|
AudioMimeType.WEBM,
|
||||||
AudioMimeType.WEBMA
|
AudioMimeType.WEBMA,
|
||||||
|
AudioMimeType.AWB
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
get codecsToForceAAC() {
|
get codecsToForceAAC() {
|
||||||
|
@ -47,7 +47,8 @@ module.exports.AudioMimeType = {
|
|||||||
AIFF: 'audio/x-aiff',
|
AIFF: 'audio/x-aiff',
|
||||||
WEBM: 'audio/webm',
|
WEBM: 'audio/webm',
|
||||||
WEBMA: 'audio/webm',
|
WEBMA: 'audio/webm',
|
||||||
MKA: 'audio/x-matroska'
|
MKA: 'audio/x-matroska',
|
||||||
|
AWB: 'audio/amr-wb'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.VideoMimeType = {
|
module.exports.VideoMimeType = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const globals = {
|
const globals = {
|
||||||
SupportedImageTypes: ['png', 'jpg', 'jpeg', 'webp'],
|
SupportedImageTypes: ['png', 'jpg', 'jpeg', 'webp'],
|
||||||
SupportedAudioTypes: ['m4b', 'mp3', 'm4a', 'flac', 'opus', 'ogg', 'oga', 'mp4', 'aac', 'wma', 'aiff', 'wav', 'webm', 'webma', 'mka'],
|
SupportedAudioTypes: ['m4b', 'mp3', 'm4a', 'flac', 'opus', 'ogg', 'oga', 'mp4', 'aac', 'wma', 'aiff', 'wav', 'webm', 'webma', 'mka', 'awb'],
|
||||||
SupportedEbookTypes: ['epub', 'pdf', 'mobi', 'azw3', 'cbr', 'cbz'],
|
SupportedEbookTypes: ['epub', 'pdf', 'mobi', 'azw3', 'cbr', 'cbz'],
|
||||||
SupportedVideoTypes: ['mp4'],
|
SupportedVideoTypes: ['mp4'],
|
||||||
TextFileTypes: ['txt', 'nfo'],
|
TextFileTypes: ['txt', 'nfo'],
|
||||||
|
@ -43,6 +43,8 @@ module.exports.parse = (nameString) => {
|
|||||||
// Example &LF: Friedman, Milton & Friedman, Rose
|
// Example &LF: Friedman, Milton & Friedman, Rose
|
||||||
if (nameString.includes('&')) {
|
if (nameString.includes('&')) {
|
||||||
nameString.split('&').forEach((asa) => splitNames = splitNames.concat(asa.split(',')))
|
nameString.split('&').forEach((asa) => splitNames = splitNames.concat(asa.split(',')))
|
||||||
|
} else if (nameString.includes(';')) {
|
||||||
|
nameString.split(';').forEach((asa) => splitNames = splitNames.concat(asa.split(',')))
|
||||||
} else {
|
} else {
|
||||||
splitNames = nameString.split(',')
|
splitNames = nameString.split(',')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user