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:
parent
f67314f6bc
commit
c362c8b0b6
|
@ -300,14 +300,18 @@ class Media(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
source = self.source
|
source = self.source
|
||||||
|
stat = os.stat(source)
|
||||||
exiftool_config = constants.exiftool_config
|
exiftool_config = constants.exiftool_config
|
||||||
if(constants.debug == True):
|
if(constants.debug == True):
|
||||||
print '%s -config "%s" -xmp-elodie:Album="%s" "%s"' % (exiftool, exiftool_config, name, source)
|
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)
|
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]
|
streamdata = process_output.communicate()[0]
|
||||||
|
|
||||||
if(process_output.returncode != 0):
|
if(process_output.returncode != 0):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
os.utime(source, (stat.st_atime, stat.st_mtime))
|
||||||
|
|
||||||
exiftool_backup_file = '%s%s' % (source, '_original')
|
exiftool_backup_file = '%s%s' % (source, '_original')
|
||||||
if(os.path.isfile(exiftool_backup_file) is True):
|
if(os.path.isfile(exiftool_backup_file) is True):
|
||||||
os.remove(exiftool_backup_file)
|
os.remove(exiftool_backup_file)
|
||||||
|
|
|
@ -109,10 +109,6 @@ class Video(Media):
|
||||||
if(seconds_since_epoch == 0):
|
if(seconds_since_epoch == 0):
|
||||||
return None
|
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)
|
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
|
# Copy file information from original source to temporary file before copying back over
|
||||||
shutil.copystat(source, temp_movie)
|
shutil.copystat(source, temp_movie)
|
||||||
|
stat = os.stat(source)
|
||||||
shutil.move(temp_movie, source)
|
shutil.move(temp_movie, source)
|
||||||
|
os.utime(source, (stat.st_atime, stat.st_mtime))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue