diff --git a/FFMpeg-Compressor/modules/printer.py b/FFMpeg-Compressor/modules/printer.py index f297a7d..a473dc0 100644 --- a/FFMpeg-Compressor/modules/printer.py +++ b/FFMpeg-Compressor/modules/printer.py @@ -8,15 +8,15 @@ def clean_str(string): def info(string): - print(clean_str(f"\r\033[0;32m[INFO]\033[0m {string}")) + print(clean_str(f"\r\033[100mI {string}\033[49m")) def warning(string): - print(clean_str(f"\r\033[0;33m[WARNING]\033[0m {string}")) + print(clean_str(f"\r\033[93mW\033[0m {string}\033[49m")) def error(string): - print(clean_str(f"\r\033[0;31m[ERROR]\033[0m {string}")) + print(clean_str(f"\r\033[31mE\033[0m {string}\033[49m")) def bar_init(folder): @@ -24,19 +24,17 @@ def bar_init(folder): for folder, folders, file in os.walk(folder): file_count += len(file) global bar - bar = IncrementalBar('Compressing', max=file_count, suffix='[%(index)d/%(max)d] (%(percent).1f%%) - ETA: %(eta)ds') + bar = IncrementalBar('Compressing', max=file_count, suffix='[%(index)d/%(max)d] (%(percent).1f%%)') def files(source, dest, dest_ext, comment): - source_ext = os.path.splitext(source)[1] source_name = os.path.splitext(source)[0] - print(clean_str(f"\r[COMP] \033[0;32m{source_name}\033[0m{source_ext}\033[0;32m -> {dest}\033[0m.{dest_ext}\033[0;32m ({comment})\033[0m")) + print(clean_str(f"\r* \033[0;37m{source_name}\033[0m{source_ext}\033[0;37m -> {dest}\033[0m.{dest_ext}\033[0;37m ({comment})\033[0m")) bar.next() def unknown_file(file): - - print(clean_str(f"\r[COMP] \033[0;33m{file}\033[0m (File extension not recognized)")) + print(clean_str(f"\r* \033[0;33m{file}\033[0m (Not recognized)")) bar.next() diff --git a/FFMpeg-Compressor/modules/utils.py b/FFMpeg-Compressor/modules/utils.py index 08074e7..dd5e80a 100644 --- a/FFMpeg-Compressor/modules/utils.py +++ b/FFMpeg-Compressor/modules/utils.py @@ -21,14 +21,11 @@ def get_compression(orig, comp): for folder, folders, files in os.walk(comp): for file in files: processed_files.append(file) - try: - comp = 100 - int((get_dir_size(comp, processed_files) / get_dir_size(orig, processed_files)) * 100) - if comp < 0: - printer.warning(f'Compression: {comp}%') - printer.warning("The resulting files are larger than the original ones!") - else: - printer.info(f'Compression: {comp}%') + orig = get_dir_size(orig, processed_files) + comp = get_dir_size(comp, processed_files) + + print(f"Result: {orig/1024/1024:.2}MB -> {comp/1024/1024:.2}MB Δ {(orig - comp)/1024/1024:.2}MB") except ZeroDivisionError: printer.warning("Nothing compressed!")