diff --git a/modules/nihonnooto/pages.py b/modules/nihonnooto/pages.py index 4ff29eae..0fc2b818 100644 --- a/modules/nihonnooto/pages.py +++ b/modules/nihonnooto/pages.py @@ -23,6 +23,7 @@ from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo __all__ = ['LivePage', 'ProgramPage'] + class LivePage(BasePage): def iter_radios_list(self): radio = Radio('nihon') @@ -34,14 +35,14 @@ class LivePage(BasePage): for el in self.document.xpath('//source'): index += 1 - mime_type = unicode(el.attrib['type']) + mime_type = unicode(el.attrib['type']) stream_url = unicode(el.attrib['src']) stream = BaseAudioStream(index) - stream.bitrate=128 - if ( mime_type == u'audio/mpeg' ): - stream.format=u'mp3' - elif ( mime_type == u'audio/ogg' ): - stream.format=u'vorbis' + stream.bitrate = 128 + if (mime_type == u'audio/mpeg'): + stream.format = u'mp3' + elif (mime_type == u'audio/ogg'): + stream.format = u'vorbis' stream.title = radio.title + ' ' + mime_type stream.url = stream_url radio.streams.append(stream) @@ -49,15 +50,14 @@ class LivePage(BasePage): yield radio - class ProgramPage(BasePage): def get_current_emission(self): current = AudioStreamInfo(0) two_or_more = unicode(self.document.xpath('//p')[0].text).split('/////')[0].split(' - ') # Consider that if String(' - ') appears it'll be in title rather in the artist name if len(two_or_more) > 2: - current.who = two_or_more.pop(0) - current.what = ' - '.join(two_or_more) + current.who = two_or_more.pop(0) + current.what = ' - '.join(two_or_more) else: - current.who, current.what = two_or_more + current.who, current.what = two_or_more return current