Added converting all videofiles to .mkv
parent
77769157e6
commit
41726dff31
20
src/main.py
20
src/main.py
|
@ -41,12 +41,22 @@ 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
|
||||
|
||||
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue