diff --git a/asdf.py b/asdf.py new file mode 100644 index 0000000..a79c099 --- /dev/null +++ b/asdf.py @@ -0,0 +1,58 @@ +import time +import sys + +toolbar_width = 40 + +# setup toolbar +sys.stdout.write("[%s]" % (" " * toolbar_width)) +sys.stdout.flush() +sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '[' + +for i in range(toolbar_width): + time.sleep(0.1) # do real work here + # update the bar + sys.stdout.write("-") + sys.stdout.flush() + +sys.stdout.write("]\n") # this ends the progress bar + +def progress_bar(iteration=0, total=0, prefix='', suffix='', decimals=1, length=50, fill='█', print_end="\r"): + """ + Call in a loop to create terminal progress bar + @params: + iteration - Required : current iteration (Int) + total - Required : total iterations (Int) + prefix - Optional : prefix string (Str) + suffix - Optional : suffix string (Str) + decimals - Optional : positive number of decimals in percent complete (Int) + length - Optional : character length of bar (Int) + fill - Optional : bar fill character (Str) + printEnd - Optional : end character (e.g. "\r", "\r\n") (Str) + """ + percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total))) + filled_length = int(length * iteration // total) + bar = fill * filled_length + '-' * (length - filled_length) + #sys.stdout.write("\b" * (filled_length + 1)) + print(f'{prefix}|{bar}| {percent}% {suffix}') + print('%s |%s| %s%% %s' % (prefix, bar, percent, suffix), end=print_end) + # Print New Line on Complete + if iteration == total: + print() + + +def toolbar(): + # setup toolbar + + toolbar_width = 40 + sys.stdout.write("[%s]" % (" " * toolbar_width)) + sys.stdout.flush() + sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '[' + + for i in range(toolbar_width): + time.sleep(0.1) # do real work here + # update the bar + sys.stdout.write("-") + sys.stdout.flush() + + sys.stdout.write("]\n") # this ends the progress bar + diff --git a/main.py b/main.py index 5330292..d59e967 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ except: print('ERROR: No PyScenedetect installed, try: sudo pip install scenedetect') -DEFAULT_ENCODE = ' --passes=1 --tile-columns=2 --tile-rows=2 --cpu-used=5 --end-usage=q --cq-level=63 --aq-mode=1' +DEFAULT_ENCODE = ' --passes=1 --tile-columns=2 --tile-rows=2 --cpu-used=8 --end-usage=q --cq-level=63 --aq-mode=0' FFMPEG = 'ffmpeg -hide_banner -loglevel warning '