Use dateutil.parser instead of specific strptime.
This commit is contained in:
parent
7a60f23ebf
commit
c32f89da7d
1 changed files with 4 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
|
import dateutil.parser
|
||||||
import io
|
import io
|
||||||
import PIL.ExifTags
|
import PIL.ExifTags
|
||||||
import PIL.Image
|
import PIL.Image
|
||||||
|
import re
|
||||||
|
|
||||||
from voussoirkit import pathclass
|
from voussoirkit import pathclass
|
||||||
|
|
||||||
|
@ -83,7 +85,8 @@ def get_exif_datetime(image) -> datetime.datetime:
|
||||||
if not exif_date:
|
if not exif_date:
|
||||||
return
|
return
|
||||||
|
|
||||||
return datetime.datetime.strptime(exif_date, '%Y:%m:%d %H:%M:%S')
|
exif_date = re.sub(r'(\d\d\d\d):(\d\d):(\d\d)', r'\1-\2-\3', exif_date)
|
||||||
|
return dateutil.parser.parse(exif_date)
|
||||||
|
|
||||||
def pad_to_square(image, background_color=None) -> PIL.Image:
|
def pad_to_square(image, background_color=None) -> PIL.Image:
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue