diff --git a/src/main.py b/src/main.py index a7039b1..fef4752 100644 --- a/src/main.py +++ b/src/main.py @@ -41,18 +41,28 @@ def copy_file(source: str, destination: str): def process_file(source_dir: str, file: str): outputdir = source_dir.replace(conf.sourcedir, conf.outputdir) - av1file = f"AV1_{file}" + outputfile = file + + if videofile_test(file=file) and not outputfile.endswith(".mkv"): + name = outputfile.split(".") + name[len(name) - 1] = ".mkv" + filename = "" + for a in name: + filename = filename + a + outputfile = filename + + av1file = f"AV1_{outputfile}" if not os.path.exists(outputdir): os.makedirs(outputdir) # create dir if not exist - if os.path.exists(os.path.join(outputdir, file)): + if os.path.exists(os.path.join(outputdir, outputfile)): print("Output File Exist --> Skipping") return False if videofile_test(file=file): print( - f"Move video file: {os.path.join(source_dir,file)} --> {os.path.join(conf.workdir, file)}" + f"Move video file: {os.path.join(source_dir, file)} --> {os.path.join(conf.workdir, file)}" ) copy_file(os.path.join(source_dir, file), os.path.join(conf.workdir, file)) @@ -65,9 +75,11 @@ def process_file(source_dir: str, file: str): ) print( - f"Move video file: {os.path.join(conf.workdir, av1file)} --> {os.path.join(outputdir, file)}" + f"Move video file: {os.path.join(conf.workdir, av1file)} --> {os.path.join(outputdir, outputfile)}" + ) + copy_file( + os.path.join(conf.workdir, av1file), os.path.join(outputdir, outputfile) ) - copy_file(os.path.join(conf.workdir, av1file), os.path.join(outputdir, file)) os.remove(os.path.join(conf.workdir, av1file)) os.remove(os.path.join(conf.workdir, file))