From b0f1f2c91e28706f1983a661c44979882eeae8be Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 15 May 2014 21:15:49 -0700 Subject: [PATCH] Fixes date timezone issues --- gui/slick/interfaces/default/displayShow.tmpl | 2 +- sickbeard/network_timezones.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/slick/interfaces/default/displayShow.tmpl b/gui/slick/interfaces/default/displayShow.tmpl index d6e3e8be..4389f6c2 100644 --- a/gui/slick/interfaces/default/displayShow.tmpl +++ b/gui/slick/interfaces/default/displayShow.tmpl @@ -271,7 +271,7 @@ #end if $epResult["name"] - #if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network))# + #if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network,True))# #if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()): #set $epLoc = os.path.basename($epLoc[len($show._location)+1:]) diff --git a/sickbeard/network_timezones.py b/sickbeard/network_timezones.py index 77f80fac..081ca411 100644 --- a/sickbeard/network_timezones.py +++ b/sickbeard/network_timezones.py @@ -225,7 +225,7 @@ def get_network_timezone(network, network_dict): # parse date and time string into local time -def parse_date_time(d, t, network): +def parse_date_time(d, t, network, local=False): if network_dict is None: load_network_dict() mo = time_regex.search(t) @@ -261,7 +261,9 @@ def parse_date_time(d, t, network): foreign_timezone = get_network_timezone(network, network_dict) foreign_naive = datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=foreign_timezone) try: - return foreign_naive.replace(tzinfo=sb_timezone).astimezone(sb_timezone) + if local: + return foreign_naive.replace(tzinfo=sb_timezone).astimezone(sb_timezone) + return foreign_naive.astimezone(sb_timezone) except (ValueError): return foreign_naive