From c4c9af8e3bb7fdfcc051774c64a37ab396e2c921 Mon Sep 17 00:00:00 2001 From: Fabrice Quenneville Date: Sun, 15 Nov 2020 12:36:37 -0500 Subject: [PATCH] Cleaning comments --- curator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/curator.py b/curator.py index 5a9ac9b..10d3f50 100755 --- a/curator.py +++ b/curator.py @@ -189,10 +189,11 @@ def get_videolist(parentdir, inputs = ["any"], filters = []): def get_resolution(filename): try: - #args = ["ffprobe","-v","error","-select_streams","v:0", "-ignore_chapters", "1", "-show_entries","stream=width,height","-of","csv=s=x:p=0",str(filename)] args = ["ffprobe","-v","error","-select_streams","v:0", "-show_entries","stream=width,height","-of","csv=s=x:p=0",str(filename)] output = subprocess.check_output(args, stderr=subprocess.STDOUT) output = output.decode().strip() + + # Dealing with malformed video chapters if "Referenced QT chapter track not found" in output: args = ["ffprobe","-v","error","-select_streams","v:0", "-ignore_chapters", "1", "-show_entries","stream=width,height","-of","csv=s=x:p=0",str(filename)] output = subprocess.check_output(args, stderr=subprocess.STDOUT) @@ -212,10 +213,11 @@ def get_size(filename): def get_codec(filename): try: - #args = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-ignore_chapters", "1", "-show_entries", "stream=codec_name", "-of", "default=noprint_wrappers=1:nokey=1", str(filename)] args = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=codec_name", "-of", "default=noprint_wrappers=1:nokey=1", str(filename)] output = subprocess.check_output(args, stderr=subprocess.STDOUT) output = output.decode().strip() + + # Dealing with malformed video chapters if "Referenced QT chapter track not found" in output: args = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-ignore_chapters", "1", "-show_entries", "stream=codec_name", "-of", "default=noprint_wrappers=1:nokey=1", str(filename)] output = subprocess.check_output(args, stderr=subprocess.STDOUT) @@ -228,8 +230,7 @@ def get_codec(filename): def convert(oldfilename, newfilename, codec = "x265"): oldsize = get_size(oldfilename) resolution = get_resolution(oldfilename) - #print(resolution) - #print(get_codec(oldfilename)) + print(f"{bcolors.OKGREEN}Starting conversion of {oldfilename}{bcolors.OKCYAN}({oldsize}mb)({resolution[0]}p){bcolors.OKGREEN} from {bcolors.OKCYAN}{get_codec(oldfilename)}{bcolors.OKGREEN} to {bcolors.OKCYAN}{codec}{bcolors.OKGREEN}...{bcolors.ENDC}") # Preparing ffmpeg command and input file