Allow sort_date to work on videos that are only YYYY-MM-DD with a name.

This commit is contained in:
voussoir 2026-08-30 08:16:11 -07:00
parent 13adfaf402
commit af4ea8ed2c

View file

@ -313,7 +313,10 @@ class Video:
# if 'creation_time' in probe['format']['tags']: # if 'creation_time' in probe['format']['tags']:
# self.sort_date = dateutil.parser.isoparse(probe['format']['tags']['creation_time']).astimezone() # self.sort_date = dateutil.parser.isoparse(probe['format']['tags']['creation_time']).astimezone()
# else: # else:
try:
self.sort_date = datetime.datetime.strptime(self.article_id.split(' ')[0], '%Y-%m-%d_%H-%M-%S').astimezone() self.sort_date = datetime.datetime.strptime(self.article_id.split(' ')[0], '%Y-%m-%d_%H-%M-%S').astimezone()
except ValueError:
self.sort_date = datetime.datetime.strptime(self.article_id.split(' ')[0], '%Y-%m-%d').astimezone()
# print(self.article_id, self.sort_date) # print(self.article_id, self.sort_date)
self.exposure_time = 0 self.exposure_time = 0