mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Handle astimezone() exceptions when scheduling
See http://www.mobileread.com/forums/showthread.php?t=275411
This commit is contained in:
parent
2e20978300
commit
79cfd37e86
@ -424,14 +424,20 @@ class SchedulerConfig(object):
|
|||||||
return utcnow() - ld > timedelta(sch)
|
return utcnow() - ld > timedelta(sch)
|
||||||
elif typ == 'day/time':
|
elif typ == 'day/time':
|
||||||
now = nowf()
|
now = nowf()
|
||||||
ld_local = ld.astimezone(local_tz)
|
try:
|
||||||
|
ld_local = ld.astimezone(local_tz)
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
day, hour, minute = sch
|
day, hour, minute = sch
|
||||||
return is_weekday(day, now) and \
|
return is_weekday(day, now) and \
|
||||||
not was_downloaded_already_today(ld_local, now) and \
|
not was_downloaded_already_today(ld_local, now) and \
|
||||||
is_time(now, hour, minute)
|
is_time(now, hour, minute)
|
||||||
elif typ == 'days_of_week':
|
elif typ == 'days_of_week':
|
||||||
now = nowf()
|
now = nowf()
|
||||||
ld_local = ld.astimezone(local_tz)
|
try:
|
||||||
|
ld_local = ld.astimezone(local_tz)
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
days, hour, minute = sch
|
days, hour, minute = sch
|
||||||
have_day = False
|
have_day = False
|
||||||
for day in days:
|
for day in days:
|
||||||
@ -443,7 +449,10 @@ class SchedulerConfig(object):
|
|||||||
is_time(now, hour, minute)
|
is_time(now, hour, minute)
|
||||||
elif typ == 'days_of_month':
|
elif typ == 'days_of_month':
|
||||||
now = nowf()
|
now = nowf()
|
||||||
ld_local = ld.astimezone(local_tz)
|
try:
|
||||||
|
ld_local = ld.astimezone(local_tz)
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
days, hour, minute = sch
|
days, hour, minute = sch
|
||||||
have_day = now.day in days
|
have_day = now.day in days
|
||||||
return have_day and \
|
return have_day and \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user