mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Fix muxing for MPD
This commit is contained in:
parent
7121d254f6
commit
d1d9840629
3 changed files with 30 additions and 5 deletions
5
@types/crunchyTypes.d.ts
vendored
5
@types/crunchyTypes.d.ts
vendored
|
|
@ -82,6 +82,11 @@ export type DownloadedMedia = {
|
||||||
lang: LanguageItem,
|
lang: LanguageItem,
|
||||||
path: string,
|
path: string,
|
||||||
isPrimary?: boolean
|
isPrimary?: boolean
|
||||||
|
} | {
|
||||||
|
type: 'Audio',
|
||||||
|
lang: LanguageItem,
|
||||||
|
path: string,
|
||||||
|
isPrimary?: boolean
|
||||||
} | ({
|
} | ({
|
||||||
type: 'Subtitle',
|
type: 'Subtitle',
|
||||||
cc: boolean
|
cc: boolean
|
||||||
|
|
|
||||||
28
crunchy.ts
28
crunchy.ts
|
|
@ -1436,7 +1436,7 @@ export default class Crunchy implements ServiceClass {
|
||||||
dlFailed = true;
|
dlFailed = true;
|
||||||
}
|
}
|
||||||
files.push({
|
files.push({
|
||||||
type: 'Video',
|
type: 'Audio',
|
||||||
path: `${tsFile}.audio.ts`,
|
path: `${tsFile}.audio.ts`,
|
||||||
lang: lang,
|
lang: lang,
|
||||||
isPrimary: isPrimary
|
isPrimary: isPrimary
|
||||||
|
|
@ -1695,16 +1695,36 @@ export default class Crunchy implements ServiceClass {
|
||||||
|
|
||||||
public async muxStreams(data: DownloadedMedia[], options: CrunchyMuxOptions) {
|
public async muxStreams(data: DownloadedMedia[], options: CrunchyMuxOptions) {
|
||||||
this.cfg.bin = await yamlCfg.loadBinCfg();
|
this.cfg.bin = await yamlCfg.loadBinCfg();
|
||||||
|
let hasAudioStreams = false;
|
||||||
if (options.novids || data.filter(a => a.type === 'Video').length === 0)
|
if (options.novids || data.filter(a => a.type === 'Video').length === 0)
|
||||||
return console.info('Skip muxing since no vids are downloaded');
|
return console.info('Skip muxing since no vids are downloaded');
|
||||||
|
if (data.some(a => a.type === 'Audio')) {
|
||||||
|
hasAudioStreams = true;
|
||||||
|
}
|
||||||
const merger = new Merger({
|
const merger = new Merger({
|
||||||
onlyVid: [],
|
onlyVid: hasAudioStreams ? data.filter(a => a.type === 'Video').map((a) : MergerInput => {
|
||||||
|
if (a.type === 'Subtitle')
|
||||||
|
throw new Error('Never');
|
||||||
|
return {
|
||||||
|
lang: a.lang,
|
||||||
|
path: a.path,
|
||||||
|
};
|
||||||
|
}) : [],
|
||||||
skipSubMux: options.skipSubMux,
|
skipSubMux: options.skipSubMux,
|
||||||
onlyAudio: [],
|
onlyAudio: hasAudioStreams ? data.filter(a => a.type === 'Audio').map((a) : MergerInput => {
|
||||||
|
if (a.type === 'Subtitle')
|
||||||
|
throw new Error('Never');
|
||||||
|
return {
|
||||||
|
lang: a.lang,
|
||||||
|
path: a.path,
|
||||||
|
};
|
||||||
|
}) : [],
|
||||||
output: `${options.output}.${options.mp4 ? 'mp4' : 'mkv'}`,
|
output: `${options.output}.${options.mp4 ? 'mp4' : 'mkv'}`,
|
||||||
subtitles: data.filter(a => a.type === 'Subtitle').map((a) : SubtitleInput => {
|
subtitles: data.filter(a => a.type === 'Subtitle').map((a) : SubtitleInput => {
|
||||||
if (a.type === 'Video')
|
if (a.type === 'Video')
|
||||||
throw new Error('Never');
|
throw new Error('Never');
|
||||||
|
if (a.type === 'Audio')
|
||||||
|
throw new Error('Never');
|
||||||
return {
|
return {
|
||||||
file: a.path,
|
file: a.path,
|
||||||
language: a.language,
|
language: a.language,
|
||||||
|
|
@ -1714,7 +1734,7 @@ export default class Crunchy implements ServiceClass {
|
||||||
simul: false,
|
simul: false,
|
||||||
keepAllVideos: options.keepAllVideos,
|
keepAllVideos: options.keepAllVideos,
|
||||||
fonts: Merger.makeFontsList(this.cfg.dir.fonts, data.filter(a => a.type === 'Subtitle') as sxItem[]),
|
fonts: Merger.makeFontsList(this.cfg.dir.fonts, data.filter(a => a.type === 'Subtitle') as sxItem[]),
|
||||||
videoAndAudio: data.filter(a => a.type === 'Video').map((a) : MergerInput => {
|
videoAndAudio: hasAudioStreams ? [] : data.filter(a => a.type === 'Video').map((a) : MergerInput => {
|
||||||
if (a.type === 'Subtitle')
|
if (a.type === 'Subtitle')
|
||||||
throw new Error('Never');
|
throw new Error('Never');
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "multi-downloader-nx",
|
"name": "multi-downloader-nx",
|
||||||
"short_name": "aniDL",
|
"short_name": "aniDL",
|
||||||
"version": "4.4.1",
|
"version": "4.5.0",
|
||||||
"description": "Downloader for Crunchyroll, Funimation, or Hidive via CLI or GUI",
|
"description": "Downloader for Crunchyroll, Funimation, or Hidive via CLI or GUI",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"download",
|
"download",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue