From 56847511b9e1c0176f2ef2161004b584fa6cb477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Dr=C3=A4s?= Date: Sat, 15 Oct 2016 22:00:51 +0200 Subject: [PATCH] gh-139 Add files via upload added hours, minutes and seconds --- elodie/filesystem.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index b1c341e..69c306f 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -235,17 +235,17 @@ class FileSystem(object): # Initialize date taken to what's returned from the metadata function. # If the folder and file name follow a time format of # YYYY-MM/DD-IMG_0001.JPG then we override the date_taken - (year, month, day) = [None] * 3 - year_month_day_match = re.search('(\d{4})-(\d{2})-(\d{2})', file_name) + (year, month, day, hour, minute, second) = [None] * 6 + year_month_day_match = re.search('(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})', file_name) if(year_month_day_match is not None): - (year, month, day) = year_month_day_match.groups() + (year, month, day, hour, minute, second) = year_month_day_match.groups() # check if the file system path indicated a date and if so we # override the metadata value - if(year is not None and month is not None and day is not None): + if(year is not None and month is not None and day is not None and hour is not None and minute is not None and second is not None): date_taken = time.strptime( - '{}-{}-{}'.format(year, month, day), - '%Y-%m-%d' + '{}-{}-{} {}:{}:{}'.format(year, month, day, hour, minute, second), + '%Y-%m-%d %H:%M:%S' ) os.utime(file, (time.time(), time.mktime(date_taken)))