diff --git a/channels/tunein.py b/channels/tunein.py index 20d12efa..f30fd445 100644 --- a/channels/tunein.py +++ b/channels/tunein.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per altadefinizione01 +# Canale per tunein # ------------------------------------------------------------ -from core import support +from core import scrapertools, support +from platformcode import logger host = 'http://api.radiotime.com' headers = [['Referer', host]] @@ -32,6 +33,7 @@ def radio(item): data = support.match(item, patron= r'text="(?P[^\("]+)(?:\((?P<location>[^\)]+)\))?" URL="(?P<url>[^"]+)" bitrate="(?P<quality>[^"]+)" reliability="[^"]+" guide_id="[^"]+" subtext="(?P<song>[^"]+)" genre_id="[^"]+" formats="(?P<type>[^"]+)" (?:playing="[^"]+" )?(?:playing_image="[^"]+" )?(?:show_id="[^"]+" )?(?:item="[^"]+" )?image="(?P<thumb>[^"]+)"') if data.matches: for title, location, url, quality, song, type, thumbnail in data.matches: + title = scrapertools.unescape(title) itemlist.append( item.clone(title = support.typo(title, 'bold') + support.typo(quality + ' kbps','_ [] bold color kod'), thumbnail = thumbnail, @@ -43,6 +45,7 @@ def radio(item): matches = support.match(data.data, patron= r'text="(?P<title>[^\("]+)(?:\([^\)]+\))?" URL="(?P<url>[^"]+)" (?:guide_id="[^"]+" )?(?:stream_type="[^"]+" )?topic_duration="(?P<duration>[^"]+)" subtext="(?P<plot>[^"]+)" item="[^"]+" image="(?P<thumb>[^"]+)"').matches if matches: for title, url, duration, plot, thumbnail in matches: + title = scrapertools.unescape(title) infoLabels={} infoLabels['duration'] = duration itemlist.append( @@ -56,12 +59,14 @@ def radio(item): else: matches = support.match(data.data, patron= r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"').matches for title, url in matches: + title = scrapertools.unescape(title) itemlist.append( item.clone(channel = item.channel, title = support.typo(title, 'bold'), thumbnail = item.thumbnail, url = url, action = 'radio')) + support.nextPage(itemlist, item, data.data, r'(?P<url>[^"]+)" key="nextStations') return itemlist @@ -86,5 +91,5 @@ def search(item, text): except: import sys for line in sys.exc_info(): - support.logger.error("%s" % line) + logger.error("%s" % line) return []