Update to mkv command
This commit is contained in:
parent
9f1b694535
commit
44fdad9863
@ -1,6 +1,7 @@
|
||||
import { addSubtitleTrack } from "./commands/add-subs.js";
|
||||
import { extractToEpisodeNumber } from "./commands/extract-to-se.js";
|
||||
import { finalizeFileNames } from "./commands/finalize-filenames.js";
|
||||
import { convertToMkv } from "./commands/to-mkv.js";
|
||||
|
||||
export const CommandConfig = [
|
||||
{
|
||||
@ -20,5 +21,11 @@ export const CommandConfig = [
|
||||
commands: ['-s'],
|
||||
params: ['SubtitleDirectory'],
|
||||
func: addSubtitleTrack,
|
||||
},
|
||||
{
|
||||
name: 'Repackage to Mkv',
|
||||
commands: ['-m'],
|
||||
params: [],
|
||||
func: convertToMkv,
|
||||
}
|
||||
];
|
||||
23
src/commands/to-mkv.js
Normal file
23
src/commands/to-mkv.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { getFilenameObject } from "../parsing/parse-filename.js";
|
||||
import { exec } from "../shell/exec.js";
|
||||
|
||||
const AcceptedMovieExtensions = [
|
||||
'.mp4',
|
||||
'.avi',
|
||||
'.mkv',
|
||||
'.mov',
|
||||
'.webm'
|
||||
];
|
||||
|
||||
export async function convertToMkv(inputDir, inputFile, outputDir, options) {
|
||||
const filenameObject = getFilenameObject(inputFile);
|
||||
if(!AcceptedMovieExtensions.includes(filenameObject.extension)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await exec(
|
||||
`ffmpeg -i ${inputDir}${inputFile} -map 0 -c copy ${outputDir}${filenameObject.prefix}.mkv`
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user