diff --git a/src/episode.ts b/src/episode.ts index a18c601..f3bb3c0 100644 --- a/src/episode.ts +++ b/src/episode.ts @@ -51,7 +51,8 @@ function download(config: typings.IConfig, page: typings.IEpisodePage, player: t downloadVideo(config, page, player, filePath, err => { if (err) return done(err); if (config.merge) return complete('Finished ' + fileName, now, done); - video.merge(config, player.video.file, filePath, err => { + var isSubtited = Boolean(player.subtitle); + video.merge(config, isSubtited, player.video.file, filePath, err => { if (err) return done(err); complete('Finished ' + fileName, now, done); }); diff --git a/src/video/merge.ts b/src/video/merge.ts index a5c2285..881d998 100644 --- a/src/video/merge.ts +++ b/src/video/merge.ts @@ -10,13 +10,13 @@ import typings = require('../typings'); /** * Merges the subtitle and video files into a Matroska Multimedia Container. */ -function main(config: typings.IConfig, rtmpInputPath: string, filePath: string, done: (err: Error) => void) { +function main(config: typings.IConfig, isSubtitled: boolean, rtmpInputPath: string, filePath: string, done: (err: Error) => void) { var subtitlePath = filePath + '.' + (subtitle.formats[config.format] ? config.format : 'ass'); var videoPath = filePath + path.extname(rtmpInputPath); childProcess.exec(command() + ' ' + '-o "' + filePath + '.mkv" ' + '"' + videoPath + '" ' + - '"' + subtitlePath + '"', { + (isSubtitled ? '"' + subtitlePath + '"' : ''), { maxBuffer: Infinity }, err => { if (err) return done(err);