changed to dict
This commit is contained in:
@@ -19,9 +19,17 @@ def is_file_video(path:str):
|
||||
else: return False
|
||||
|
||||
|
||||
def is_file_picture(path:str):
|
||||
mime = magic.Magic(mime=True)
|
||||
file = mime.from_file(path)
|
||||
if file.find('picture') != -1: return True
|
||||
else: return False
|
||||
|
||||
|
||||
def get_image_meta_data(image_path):
|
||||
image_extension = str(image_path).split("/")[-1].split(".")
|
||||
# TODO: Sort out videos
|
||||
if is_file_video(path=image_path): return False
|
||||
img = Image.open(f"{image_path}")
|
||||
values = []
|
||||
for tag, text in img.getexif().items():
|
||||
@@ -36,6 +44,7 @@ def filter_date_and_make(meta_tags:list, image_path):
|
||||
month = None
|
||||
year = None
|
||||
time = None
|
||||
print(meta_tags)
|
||||
make = str(meta_tags[1]).split("|")[1]
|
||||
image_name = str(image_path).split("/")[-1]
|
||||
|
||||
@@ -46,7 +55,17 @@ def filter_date_and_make(meta_tags:list, image_path):
|
||||
month = int(_date[1])
|
||||
year = int(_date[0])
|
||||
|
||||
return ExifData(image_path=image_path, image_name=image_name, day=day, month=month, year=year, time=time, make=make)
|
||||
exif_data_dict = {
|
||||
"day": day,
|
||||
"month": month,
|
||||
"year": year,
|
||||
"make": make,
|
||||
"time": time,
|
||||
"image_path": image_path,
|
||||
"image_name": image_name
|
||||
}
|
||||
|
||||
return ExifData(exif_data_dict)
|
||||
|
||||
|
||||
def filter_data(value):
|
||||
|
||||
Reference in New Issue
Block a user