From 5d7f9cd8bc45a21897ac7ab600255ffca5712304 Mon Sep 17 00:00:00 2001 From: walcutt Date: Tue, 24 Jun 2025 17:38:43 -0400 Subject: [PATCH] Add rename command for movies --- src/command-config.js | 9 ++++++++- src/commands/rename.js | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/commands/rename.js diff --git a/src/command-config.js b/src/command-config.js index 512c335..4556c4a 100644 --- a/src/command-config.js +++ b/src/command-config.js @@ -6,6 +6,7 @@ import { help } from "./commands/help.js"; import { preferAudio } from "./commands/prefer-audio.js"; import { preferSubtitles } from "./commands/prefer-subs.js"; import { removeSubtitles } from "./commands/remove-subs.js"; +import { forceRename } from "./commands/rename.js"; import { saveSubtitlesToFile } from "./commands/save-subtitles-to-file.js"; import { convertToMkv } from "./commands/to-mkv.js"; import { convertToMp4 } from "./commands/to-mp4.js"; @@ -25,10 +26,16 @@ export const CommandConfig = [ }, { name: 'Finalize File Names', - commands: ['-o', '-output-as', '-rename'], + commands: ['-o', '-output-as', '-rename-series'], params: ['ShowName'], func: finalizeFileNames, }, + { + name: 'Force Rename', + commands: ['-rn', '-rename', '-force-rename'], + params: ['Name'], + func:forceRename, + }, { name: 'Add Subtitle Track', commands: ['-s', '-subtitle', '-add-subtitles'], diff --git a/src/commands/rename.js b/src/commands/rename.js new file mode 100644 index 0000000..ba538ce --- /dev/null +++ b/src/commands/rename.js @@ -0,0 +1,10 @@ +import fs from 'fs'; +import { getFilenameObject } from '../parsing/parse-filename.js'; + +export async function forceRename(inputDir, inputFile, outputDir, { Name }) { + const filenameObject = getFilenameObject(inputFile); + + const toWrite = `${outputDir}${Name}${filenameObject.extension}`; + + fs.cpSync(`${inputDir}${inputFile}`, `${toWrite}`); +} \ No newline at end of file