gh-2 Roll back calling set_date_taken from within get_date_taken and apply stat times back to file when adding album

This commit is contained in:
Jaisen Mathai 2015-12-01 00:39:05 -08:00
parent f67314f6bc
commit c362c8b0b6
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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
"""