diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-04-18 10:53:40 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-04-18 10:53:40 +0200 |
commit | 0dd6c2df5037c22a67f646944a69b77c6fe0ba69 (patch) | |
tree | fcf4690d98d88c2621871f6c611efd87d03bf10a /bin | |
parent | 2c93b349e49e321f8bc65f17f3337324676fe1d4 (diff) |
add a prograss bar
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pyggle | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -6,10 +6,15 @@ import exifread import os import PIL from PIL import Image +from progress.bar import Bar import shutil import sys +class ProgressBar(Bar): + suffix = "%(percent).0f%% [%(elapsed_td)s/%(eta_td)s]" + + def rotate_image(image, exif_tag): if "Image Orientation" not in exif_tag: return image @@ -42,8 +47,13 @@ def format_fsi(exif_tag): pass try: - shutter = float(exif_tag["EXIF ShutterSpeedValue"].values[0]) - entries.append(f"1/{format_f(shutter)}s") + exposure = float(exif_tag["EXIF ExposureTime"].values[0]) + if exposure >= 1: + entries.append(f"{format_f(exposure)}s") + elif exposure >= 1e-3: + entries.append(f"{format_f(exposure * 1e3)}ms") + else: + entries.append(f"{format_f(exposure * 1e6)}µs") except (KeyError, ZeroDivisionError): pass @@ -92,7 +102,6 @@ def format_make_model_lens(exif_tag): def format_exif(exif_tag): exif_lines = list() - # print(exif_tag) try: dt = datetime.strptime( @@ -186,7 +195,9 @@ if __name__ == "__main__": with open(f"{base_dir}/share/html_start", "r") as f: html_buf = f.read() - for filename in sys.argv[1:]: + filenames = sys.argv[1:] + + for filename in ProgressBar(max=len(filenames)).iter(filenames): with open(filename, "rb") as f: exif_tag = exifread.process_file(f) |