Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions resources/lib/lib_joyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
if compat.PY2:
from urllib import urlencode
from HTMLParser import HTMLParser
html = HTMLParser()
from urlparse import urlparse, parse_qs
try:
from simplejson import dumps
except ImportError:
from json import dumps
elif compat.PY3:
from urllib.parse import urlencode, urlparse, parse_qs
from html.parser import HTMLParser
import html
from json import dumps


Expand Down Expand Up @@ -704,7 +705,7 @@ def get_metadata(data, query_type, title_type_id=None):
if 'TEXTS' in CONST['GRAPHQL']['METADATA'][query_type].keys():
for text_key, text_mapping_key in CONST['GRAPHQL']['METADATA'][query_type]['TEXTS'].items():
if text_key in data.keys() and data[text_key] is not None:
metadata['infoLabels'].update({text_mapping_key: HTMLParser().unescape(data[text_key])})
metadata['infoLabels'].update({text_mapping_key: html.unescape(data[text_key])})
else:
metadata['infoLabels'].update({text_mapping_key: ''})

Expand Down Expand Up @@ -794,15 +795,15 @@ def get_metadata(data, query_type, title_type_id=None):
})
if 'series' in data.keys():
if 'title' in data['series'].keys():
metadata['infoLabels'].update({'tvshowtitle': HTMLParser().unescape(data['series']['title'])})
metadata['infoLabels'].update({'tvshowtitle': html.unescape(data['series']['title'])})
series_meta = lib_joyn.get_metadata(data['series'], 'TVSHOW')
if 'clearlogo' in series_meta['art'].keys():
metadata['art'].update({'clearlogo': series_meta['art']['clearlogo']})

elif 'compilation' in data.keys():
compilation_meta = lib_joyn.get_metadata(data['compilation'], 'TVSHOW')
if 'title' in data['compilation'].keys():
metadata['infoLabels'].update({'tvshowtitle': HTMLParser().unescape(data['compilation']['title'])})
metadata['infoLabels'].update({'tvshowtitle': html.unescape(data['compilation']['title'])})
if 'clearlogo' in compilation_meta['art'].keys():
metadata['art'].update({'clearlogo': compilation_meta['art']['clearlogo']})

Expand Down