mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58:01 -05:00
Fix for topdown issue in postprocessTV
This commit is contained in:
parent
e0558ea4cd
commit
0657589be0
@ -30,15 +30,17 @@ def fixStupidEncodings(x, silent=False):
|
|||||||
try:
|
try:
|
||||||
return x.decode(sickbeard.SYS_ENCODING)
|
return x.decode(sickbeard.SYS_ENCODING)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
logger.log(u"Unable to decode value: "+repr(x), logger.ERROR)
|
logger.log(u"Unable to decode value: " + repr(x), logger.ERROR)
|
||||||
return None
|
return None
|
||||||
elif type(x) == unicode:
|
elif type(x) == unicode:
|
||||||
return x
|
return x
|
||||||
else:
|
else:
|
||||||
logger.log(u"Unknown value passed in, ignoring it: "+str(type(x))+" ("+repr(x)+":"+repr(type(x))+")", logger.DEBUG if silent else logger.ERROR)
|
logger.log(
|
||||||
|
u"Unknown value passed in, ignoring it: " + str(type(x)) + " (" + repr(x) + ":" + repr(type(x)) + ")",
|
||||||
|
logger.DEBUG if silent else logger.ERROR)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def fixListEncodings(x):
|
def fixListEncodings(x):
|
||||||
if type(x) != list and type(x) != tuple:
|
if type(x) != list and type(x) != tuple:
|
||||||
@ -46,24 +48,28 @@ def fixListEncodings(x):
|
|||||||
else:
|
else:
|
||||||
return filter(lambda x: x != None, map(fixStupidEncodings, x))
|
return filter(lambda x: x != None, map(fixStupidEncodings, x))
|
||||||
|
|
||||||
|
|
||||||
def callPeopleStupid(x):
|
def callPeopleStupid(x):
|
||||||
try:
|
try:
|
||||||
return x.encode(sickbeard.SYS_ENCODING)
|
return x.encode(sickbeard.SYS_ENCODING)
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
logger.log(u"YOUR COMPUTER SUCKS! Your data is being corrupted by a bad locale/encoding setting. Report this error on the forums or IRC please: "+repr(x)+", "+sickbeard.SYS_ENCODING, logger.ERROR)
|
logger.log(
|
||||||
|
u"YOUR COMPUTER SUCKS! Your data is being corrupted by a bad locale/encoding setting. Report this error on the forums or IRC please: " + repr(
|
||||||
|
x) + ", " + sickbeard.SYS_ENCODING, logger.ERROR)
|
||||||
return x.encode(sickbeard.SYS_ENCODING, 'ignore')
|
return x.encode(sickbeard.SYS_ENCODING, 'ignore')
|
||||||
|
|
||||||
def ek(func, *args):
|
|
||||||
|
def ek(func, *args, **kwargs):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
result = func(*args)
|
result = func(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
result = func(*[callPeopleStupid(x) if type(x) in (str, unicode) else x for x in args])
|
result = func(*[callPeopleStupid(x) if type(x) in (str, unicode) else x for x in args], **kwargs)
|
||||||
|
|
||||||
if type(result) in (list, tuple):
|
if type(result) in (list, tuple):
|
||||||
return fixListEncodings(result)
|
return fixListEncodings(result)
|
||||||
elif type(result) == str:
|
elif type(result) == str:
|
||||||
return fixStupidEncodings(result)
|
return fixStupidEncodings(result)
|
||||||
else:
|
else:
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user