From 28f019a19f70c586a59e5ea67af8e2552fa82ad1 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Mon, 18 Nov 2019 00:21:17 +0100 Subject: [PATCH] Update var in constant --- organize_my_photos.py | 6 ++++-- setup.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/organize_my_photos.py b/organize_my_photos.py index 2399626..43a73ea 100644 --- a/organize_my_photos.py +++ b/organize_my_photos.py @@ -10,13 +10,15 @@ import calendar import shutil from PIL import Image +META_CREATED = 36867 + def get_date_created(filename): image = Image.open(filename) image.verify() # Format date d/m/Y - if image._getexif() is not None and '36867' in image._getexif(): + if image._getexif() is not None and str(META_CREATED) in image._getexif(): # Metadata - return time.strftime('%d/%m/%Y', datetime.datetime.strptime(image._getexif()[36867], "%Y:%m:%d %H:%M:%S").timetuple()) + return time.strftime('%d/%m/%Y', datetime.datetime.strptime(image._getexif()[META_CREATED], "%Y:%m:%d %H:%M:%S").timetuple()) else: # Create data file return time.strftime('%d/%m/%Y', time.gmtime(os.path.getctime(filename))) diff --git a/setup.py b/setup.py index 9988bd9..c2ff786 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name = 'Organize-my-photos', py_modules=['organize_my_photos'], - version = '1.0.4', + version = '1.0.5', python_requires='>3.6', description = 'Terminal program that organizes and organizes the photographs in folders by year, month and day.', author = 'Andros Fenollosa',