Skip to content

Commit

Permalink
Apply suggestion from @varnav
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastGimbus committed Jan 6, 2021
1 parent dc305da commit 63dad25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions google_photos_takeout_helper/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def main():
import piexif as _piexif
from fractions import Fraction # piexif requires some values to be stored as rationals
import math
if _os.name == 'nt':
import win32_setctime as _windoza_setctime

parser = _argparse.ArgumentParser(
prog='Photos takeout helper',
Expand Down Expand Up @@ -349,6 +351,8 @@ def set_creation_date_from_str(file: Path, str_datetime):
'%Y:%m:%d %H:%M:%S'
).timestamp()
_os.utime(file, (timestamp, timestamp))
if _os.name == 'nt':
_windoza_setctime.setctime()
except Exception as e:
print('Error setting creation date from string:')
print(e)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
piexif==1.1.3
win32-setctime==1.0.3

0 comments on commit 63dad25

Please sign in to comment.