From d4d12e2d418ea47dc8e5eaf31e3f91fccf05d8ed Mon Sep 17 00:00:00 2001 From: Elghinnarisa Date: Fri, 9 Sep 2022 20:18:34 +0200 Subject: [PATCH] updated --- audio_rm_drop.py | 9 ++++++--- bulk_covert_drop.py | 7 +++++-- bulk_covert_drop_5_1_audio.py | 7 +++++-- ffprobe_drop.py | 7 +++++-- getnative_aio.py | 3 +++ powershell_test | 8 -------- quality_test.py | 7 +++++-- quality_test_originals.py | 7 +++++-- screenshot_drop.py | 6 ++++-- sub-and-audio_drop.py | 7 +++++-- sub-and-audio_drop_to_file.py | 9 ++++++--- subtitle_rm_drop.py | 7 +++++-- 12 files changed, 54 insertions(+), 30 deletions(-) delete mode 100644 powershell_test diff --git a/audio_rm_drop.py b/audio_rm_drop.py index 16909c8..536ee3b 100644 --- a/audio_rm_drop.py +++ b/audio_rm_drop.py @@ -12,9 +12,12 @@ skipto = " -ss " #droppedFile = "test.mkv" -del sys.argv[0] -for i, each in enumerate(sys.argv): + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] + +for i, each in enumerate(arguments): arg_list = 'ffprobe.exe -i "{each}"'.format(each=each) @@ -36,7 +39,7 @@ x = (int(x) for x in input ("Enter tracks to keep: ").split()) track = "".join(" -map 0:a:{}".format(y) for y in x) -for each in sys.argv: +for each in arguments: path = each basename = os.path.basename(path) diff --git a/bulk_covert_drop.py b/bulk_covert_drop.py index 15358c6..4027e7e 100644 --- a/bulk_covert_drop.py +++ b/bulk_covert_drop.py @@ -16,7 +16,10 @@ print(droppedName) #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -24,7 +27,7 @@ if not isExist: os.makedirs(output_path+output_folder_name) -for file in sys.argv: +for file in arguments: basename = os.path.basename(file) print(file) diff --git a/bulk_covert_drop_5_1_audio.py b/bulk_covert_drop_5_1_audio.py index a539fd5..01e8d47 100644 --- a/bulk_covert_drop_5_1_audio.py +++ b/bulk_covert_drop_5_1_audio.py @@ -15,7 +15,10 @@ print(droppedName) #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -23,7 +26,7 @@ if not isExist: os.makedirs(output_path+output_folder_name) -for file in sys.argv: +for file in arguments: basename = os.path.basename(file) print(file) diff --git a/ffprobe_drop.py b/ffprobe_drop.py index b547558..1b7b332 100644 --- a/ffprobe_drop.py +++ b/ffprobe_drop.py @@ -10,9 +10,12 @@ skipto = " -ss " #droppedFile = "test.mkv" count = 0 -del sys.argv[0] -for each in sys.argv: + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] + +for each in arguments: i = 0 print(each) diff --git a/getnative_aio.py b/getnative_aio.py index 2bfabff..d08eaa6 100644 --- a/getnative_aio.py +++ b/getnative_aio.py @@ -12,6 +12,9 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] + + +#skip first part of sys.argv since it points to script location arguments = sys.argv[1:] #check if output folder exists, otherwise create it diff --git a/powershell_test b/powershell_test deleted file mode 100644 index ab95c48..0000000 --- a/powershell_test +++ /dev/null @@ -1,8 +0,0 @@ -import subprocess, sys -import os - -folder_path=os.getcwd() -p = subprocess.Popen(["powershell.exe", "dir"]) - - -res=p.communicate() \ No newline at end of file diff --git a/quality_test.py b/quality_test.py index c7e7d77..4062b0e 100644 --- a/quality_test.py +++ b/quality_test.py @@ -11,7 +11,10 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -28,7 +31,7 @@ lines = "-map 0:v -c:v libx265 -preset slow -crf 20 -x265-params level=51:no-sao number_of_segments=int(input("Number of segments: ")) segment_length=int(input("How long should each segment be(seconds)? ")) -for i, file in enumerate(sys.argv): +for i, file in enumerate(arguments): arg_list = 'ffprobe.exe -show_entries format=duration -i "{file}"'.format(file=file) print(arg_list) diff --git a/quality_test_originals.py b/quality_test_originals.py index 7a02249..f5039d8 100644 --- a/quality_test_originals.py +++ b/quality_test_originals.py @@ -10,7 +10,10 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -27,7 +30,7 @@ org_lineslines = " -map 0:v -c:v libx264 -crf 5 -map 0:a -c:a copy -map 0:s -c:s number_of_segments=int(input("Number of segments: ")) segment_length=int(input("How long should each segment be(seconds)? ")) -for i, file in enumerate(sys.argv): +for i, file in enumerate(arguments): arg_list = 'ffprobe.exe -show_entries format=duration -i "{file}"'.format(file=file) print(arg_list) diff --git a/screenshot_drop.py b/screenshot_drop.py index da9bd9f..ea8df77 100644 --- a/screenshot_drop.py +++ b/screenshot_drop.py @@ -12,7 +12,9 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -22,7 +24,7 @@ if not isExist: number_of_ss=int(input("Number of ss: ")) print(number_of_ss) -for i, file in enumerate(sys.argv): +for i, file in enumerate(arguments): arg_list = 'ffprobe.exe -show_entries format=duration -i "{file}"'.format(file=file) print(arg_list) diff --git a/sub-and-audio_drop.py b/sub-and-audio_drop.py index d41bdbd..c6cfcfb 100644 --- a/sub-and-audio_drop.py +++ b/sub-and-audio_drop.py @@ -15,7 +15,10 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -28,7 +31,7 @@ if not isExist: -for i, file in enumerate(sys.argv): +for i, file in enumerate(arguments): arg_list = 'ffprobe.exe -i "{file}"'.format(file=file) cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8') diff --git a/sub-and-audio_drop_to_file.py b/sub-and-audio_drop_to_file.py index dfdb2ee..c99ba75 100644 --- a/sub-and-audio_drop_to_file.py +++ b/sub-and-audio_drop_to_file.py @@ -15,7 +15,10 @@ droppedName = Path(droppedFile).name #get path of script location and remove the tail head_tail = os.path.split(sys.argv[0]) output_path = head_tail[0] -del sys.argv[0] + + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] #check if output folder exists, otherwise create it isExist = os.path.exists(output_path+output_folder_name) @@ -28,7 +31,7 @@ if not isExist: -for i, file in enumerate(sys.argv): +for i, file in enumerate(arguments): arg_list = 'ffprobe.exe -i "{file}"'.format(file=file) cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8') @@ -51,7 +54,7 @@ audio_track = "".join(" -map 0:a:{}".format(y) for y in x) z = (int(z) for z in input ("Enter subtitle tracks to keep: ").split()) subtitle_track = "".join(" -map 0:s:{}".format(y) for y in z) -for file in sys.argv: +for file in arguments: basename = os.path.basename(file) diff --git a/subtitle_rm_drop.py b/subtitle_rm_drop.py index 7a80cdc..c4ddaed 100644 --- a/subtitle_rm_drop.py +++ b/subtitle_rm_drop.py @@ -12,9 +12,12 @@ skipto = " -ss " #droppedFile = "test.mkv" -del sys.argv[0] -for i, each in enumerate(sys.argv): + +#skip first part of sys.argv since it points to script location +arguments = sys.argv[1:] + +for i, each in enumerate(arguments): arg_list = 'ffprobe.exe -i "{each}"'.format(each=each)