From c362c8b0b6ebc398031a6acd252e91028c43ee32 Mon Sep 17 00:00:00 2001 From: Jaisen Mathai Date: Tue, 1 Dec 2015 00:39:05 -0800 Subject: [PATCH] gh-2 Roll back calling set_date_taken from within get_date_taken and apply stat times back to file when adding album --- elodie/media/media.py | 4 ++++ elodie/media/video.py | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/elodie/media/media.py b/elodie/media/media.py index 3c1ac31..ad698a4 100644 --- a/elodie/media/media.py +++ b/elodie/media/media.py @@ -300,14 +300,18 @@ class Media(object): return False source = self.source + stat = os.stat(source) exiftool_config = constants.exiftool_config if(constants.debug == True): print '%s -config "%s" -xmp-elodie:Album="%s" "%s"' % (exiftool, exiftool_config, name, source) process_output = subprocess.Popen(['%s -config "%s" -xmp-elodie:Album="%s" "%s"' % (exiftool, exiftool_config, name, source)], stdout=subprocess.PIPE, shell=True) streamdata = process_output.communicate()[0] + if(process_output.returncode != 0): return False + os.utime(source, (stat.st_atime, stat.st_mtime)) + exiftool_backup_file = '%s%s' % (source, '_original') if(os.path.isfile(exiftool_backup_file) is True): os.remove(exiftool_backup_file) diff --git a/elodie/media/video.py b/elodie/media/video.py index b1857a6..b743c9f 100644 --- a/elodie/media/video.py +++ b/elodie/media/video.py @@ -109,10 +109,6 @@ class Video(Media): if(seconds_since_epoch == 0): return None - # If the time wasn't found in EXIF we need to add it there since the modified/access times frequently change - if(time_found_in_exif == False): - self.set_date_taken(datetime.fromtimestamp(seconds_since_epoch)) - return time.gmtime(seconds_since_epoch) """ @@ -322,7 +318,10 @@ class Video(Media): # Copy file information from original source to temporary file before copying back over shutil.copystat(source, temp_movie) + stat = os.stat(source) shutil.move(temp_movie, source) + os.utime(source, (stat.st_atime, stat.st_mtime)) + return True """