Update var in constant

This commit is contained in:
Andros Fenollosa 2019-11-18 00:21:17 +01:00
parent 24f53262e1
commit 28f019a19f
2 changed files with 5 additions and 3 deletions

View File

@ -10,13 +10,15 @@ import calendar
import shutil import shutil
from PIL import Image from PIL import Image
META_CREATED = 36867
def get_date_created(filename): def get_date_created(filename):
image = Image.open(filename) image = Image.open(filename)
image.verify() image.verify()
# Format date d/m/Y # 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 # 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: else:
# Create data file # Create data file
return time.strftime('%d/%m/%Y', time.gmtime(os.path.getctime(filename))) return time.strftime('%d/%m/%Y', time.gmtime(os.path.getctime(filename)))

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name = 'Organize-my-photos', name = 'Organize-my-photos',
py_modules=['organize_my_photos'], py_modules=['organize_my_photos'],
version = '1.0.4', version = '1.0.5',
python_requires='>3.6', python_requires='>3.6',
description = 'Terminal program that organizes and organizes the photographs in folders by year, month and day.', description = 'Terminal program that organizes and organizes the photographs in folders by year, month and day.',
author = 'Andros Fenollosa', author = 'Andros Fenollosa',