From be652f8efb8a0066b7df9dd2a4840b20b785b50a Mon Sep 17 00:00:00 2001 From: Javanaut Date: Tue, 31 Dec 2024 10:56:17 +0100 Subject: [PATCH] copy only mode --- src/ffx/ffx.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ffx/ffx.py b/src/ffx/ffx.py index 256a637..39a091f 100755 --- a/src/ffx/ffx.py +++ b/src/ffx/ffx.py @@ -1,6 +1,6 @@ #! /usr/bin/python3 -import os, click, time, logging +import os, click, time, logging, shutil from ffx.configuration_controller import ConfigurationController @@ -325,6 +325,8 @@ def checkUniqueDispositions(context, mediaDescriptor: MediaDescriptor): @click.option('--nice', type=int, default=99, help='Niceness of started processes') @click.option('--cpu', type=int, default=0, help='Limit CPU for started processes to percent') +@click.option('--rename-only', is_flag=True, default=False, help='Only renaming, no recoding') + def convert(ctx, paths, label, @@ -373,7 +375,8 @@ def convert(ctx, keep_mkvmerge_metadata, nice, - cpu): + cpu, + rename_only): """Batch conversion of audiovideo files in format suitable for web playback, e.g. jellyfin Files found under PATHS will be converted according to parameters. @@ -728,11 +731,14 @@ def convert(ctx, ctx.obj['logger'].info(f"Creating file {targetFilename}") - fc.runJob(sourcePath, - targetPath, - targetFormat, - context['video_encoder'], - chainIteration) + if rename_only: + shutil.copyfile(sourcePath, targetPath) + else: + fc.runJob(sourcePath, + targetPath, + targetFormat, + context['video_encoder'], + chainIteration) endTime = time.perf_counter() ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")