i18n, tests and more

This commit is contained in:
2024-05-25 22:12:11 +02:00
parent c21167f941
commit 161525fbb5
17 changed files with 117 additions and 58 deletions

View File

@@ -1,7 +1,6 @@
import os
import sys
sys.path.append("../")
import time
import shutil
import logging
from progressbar.progressbar import ProgressBar
@@ -17,22 +16,25 @@ def sort_pictures(images:list, dst:str, logger:logging.Logger):
term_width=70
)
print(f"Start sorting {image_total} images\n")
progress_bar.start()
start_timer = time.time()
for image in images:
image:ExifData
if not image: continue
path = os.path.join(dst, str(image.make), str(image.year), str(image.month), str(image.day))
if not os.path.exists(path): os.makedirs(path)
stat_info = os.stat(image.path)
shutil.move(src=image.path, dst=f"{path}/{image.name}")
image_dst = f"{path}{os.sep}{image.name}"
shutil.move(src=image.path, dst=image_dst)
# os.chmod(path=f"{path}/{image.name}", mode=stat_info.st_mode)
logger.info(f"Moved {image.path} -> {path}/{image.name}")
logger.info(f"Moved {image.path} -> {image_dst}")
progress_bar.update(image_counter)
image_counter += 1
end_timer = time.time()
progress_bar.finish()
print(f"\nDone\nSorted {image_total} images in {round(end_timer - start_timer, 2)} seconds")
def sort_raws(raws:list, dst:str, logger:logging):
pass