From 66824acc5e6b78b25b7e2d882ec35c8b1aa5c555 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Mon, 2 May 2016 01:23:15 +0200 Subject: [PATCH] Change check for parameter types in parse_date_time. --- sickbeard/network_timezones.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sickbeard/network_timezones.py b/sickbeard/network_timezones.py index d27db649..b7e5d098 100644 --- a/sickbeard/network_timezones.py +++ b/sickbeard/network_timezones.py @@ -266,7 +266,7 @@ def get_network_timezone(network): except: pass - return timezone if timezone is not None else sb_timezone + return timezone if isinstance(timezone, datetime.tzinfo) else sb_timezone def parse_time(t): @@ -306,17 +306,17 @@ def parse_time(t): # parse date and time string into local time def parse_date_time(d, t, network): - if isinstance(t, basestring): - (hr, m) = parse_time(t) - else: + if isinstance(t, tuple) and len(t) == 2 and isinstance(t[0], int) and isinstance(t[1], int): (hr, m) = t + else: + (hr, m) = parse_time(t) te = datetime.datetime.fromordinal(helpers.tryInt(d)) try: - if isinstance(network, basestring): - foreign_timezone = get_network_timezone(network) - else: + if isinstance(network, datetime.tzinfo): foreign_timezone = network + else: + foreign_timezone = get_network_timezone(network) foreign_naive = datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=foreign_timezone) return foreign_naive except: