From e3b243e7ed50d4475cde51c6d26ef5170d8dc1f6 Mon Sep 17 00:00:00 2001 From: FlorentChamault <fchamault@hubee.tv> Date: Tue, 3 Feb 2015 19:36:49 +0100 Subject: [PATCH] correct long load calendar + past_date(2 weeks last) --- sickbeard/webserve.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 192539d20..9dbd1e716 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -3902,7 +3902,7 @@ class WebInterface: myDB = db.DBConnection() # Limit dates - past_date = (datetime.date.today() + datetime.timedelta(weeks=-52)).toordinal() + past_date = (datetime.date.today() + datetime.timedelta(weeks=-2)).toordinal() future_date = (datetime.date.today() + datetime.timedelta(weeks=52)).toordinal() # Get all the shows that are not paused and are currently on air (from kjoconnor Fork) @@ -3910,16 +3910,17 @@ class WebInterface: for show in calendar_shows: # Get all episodes of this show airing between today and next month episode_list = myDB.select("SELECT tvdbid, name, season, episode, description, airdate FROM tv_episodes WHERE airdate >= ? AND airdate < ? AND showid = ?", (past_date, future_date, int(show["tvdb_id"]))) + + # Get local timezone and load network timezones + local_zone = tz.tzlocal() + try: + network_zone = network_timezones.get_network_timezone(show['network'], network_timezones.load_network_dict(), local_zone) + except: + # Dummy network_zone for exceptions + network_zone = None for episode in episode_list: - # Get local timezone and load network timezones - local_zone = tz.tzlocal() - try: - network_zone = network_timezones.get_network_timezone(show['network'], network_timezones.load_network_dict(), local_zone) - except: - # Dummy network_zone for exceptions - network_zone = None # Get the air date and time air_date = datetime.datetime.fromordinal(int(episode['airdate'])) -- GitLab