From af1c16c4da9064c4d54b7a4f0bebbd1be061ee76 Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 9 Nov 2014 00:49:53 +0800 Subject: [PATCH] Fix parsing utf8 data from tvdb and tvrage --- CHANGES.md | 1 + lib/tvdb_api/tvdb_api.py | 5 ++--- lib/tvrage_api/tvrage_api.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 99c9af77..8a38a49f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -68,6 +68,7 @@ * Fix progress sort direction for poster layout view on home page * Fix invalid use of str() in the Send2Trash library for platforms other * Fix dropdown confirm dialogs for restart and shutdown +* Fix parsing utf8 data from tvdb and tvrage ### 0.2.1 (2014-10-22 06:41:00 UTC) diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 6b64c82d..00a3bf89 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -619,10 +619,9 @@ class Tvdb: raise tvdb_error("Bad zip file received from thetvdb.com, could not read it") else: try: - return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=process) - except: return xmltodict.parse(resp.content.strip(), postprocessor=process) - + except: + return dict([(u'data', None)]) def _getetsrc(self, url, params=None, language=None): """Loads a URL using caching, returns an ElementTree of the source diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index cfde4081..9b65278a 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -479,9 +479,9 @@ class TVRage: if resp.ok: try: - return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=remap_keys) - except: return xmltodict.parse(resp.content.strip(), postprocessor=remap_keys) + except: + return dict([(u'data', None)]) def _getetsrc(self, url, params=None): """Loads a URL using caching, returns an ElementTree of the source