rename AudioStreamInfo into StreamInfo
Allowing future use with upcoming VideoStream Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
d34f8f2e40
commit
e7805cec12
10 changed files with 72 additions and 40 deletions
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
|
||||
from weboob.capabilities.radio import ICapRadio, Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
from weboob.capabilities.collection import ICapCollection, Collection
|
||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||
from weboob.tools.value import Value
|
||||
|
|
@ -236,7 +237,7 @@ class AudioAddictBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
radio.description = radio_dict['description']
|
||||
|
||||
artist, title = self.get_current(network, radioName)
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(0)
|
||||
current.who = artist
|
||||
current.what = title
|
||||
radio.current = current
|
||||
|
|
@ -268,7 +269,7 @@ class AudioAddictBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
def fill_radio(self, radio, fields):
|
||||
if 'current' in fields:
|
||||
radioName, network = radio.id.split('.', 1)
|
||||
radio.current = AudioStreamInfo(0)
|
||||
radio.current = StreamInfo(0)
|
||||
radio.current.who, radio.current.what = self.get_current(network, radioName)
|
||||
return radio
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.capabilities.radio import Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
|
||||
__all__ = ['LivePage', 'StreamsPage']
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ class StreamsPage(BasePage):
|
|||
|
||||
class LivePage(BasePage):
|
||||
def get_current_emission(self):
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(0)
|
||||
current.who = unicode(self.document.xpath('//playlist/now/entry/artist')[0].text)
|
||||
current.what = unicode(self.document.xpath('//playlist/now/entry/song')[0].text)
|
||||
return current
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.capabilities.radio import Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
|
||||
__all__ = ['LivePage', 'ProgramPage']
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ class LivePage(BasePage):
|
|||
|
||||
class ProgramPage(BasePage):
|
||||
def get_current_emission(self):
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(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:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
from cStringIO import StringIO
|
||||
|
||||
from weboob.capabilities.radio import ICapRadio, Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
from weboob.capabilities.collection import ICapCollection
|
||||
from weboob.tools.backend import BaseBackend
|
||||
from weboob.tools.browser import StandardBrowser
|
||||
|
|
@ -70,7 +71,7 @@ class NovaBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
radio.description = description
|
||||
|
||||
artist, title = self.get_current()
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(0)
|
||||
current.who = artist
|
||||
current.what = title
|
||||
radio.current = current
|
||||
|
|
@ -95,7 +96,7 @@ class NovaBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
def fill_radio(self, radio, fields):
|
||||
if 'current' in fields:
|
||||
if not radio.current:
|
||||
radio.current = AudioStreamInfo(0)
|
||||
radio.current = StreamInfo(0)
|
||||
radio.current.who, radio.current.what = self.get_current()
|
||||
return radio
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
|
||||
from weboob.capabilities.radio import ICapRadio, Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
from weboob.capabilities.collection import ICapCollection
|
||||
from weboob.tools.backend import BaseBackend
|
||||
from weboob.tools.browser import StandardBrowser
|
||||
|
|
@ -86,7 +87,7 @@ class OuiFMBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
radio.description = description
|
||||
|
||||
artist, title = self.get_current(radio.id)
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(0)
|
||||
current.who = artist
|
||||
current.what = title
|
||||
radio.current = current
|
||||
|
|
@ -102,7 +103,7 @@ class OuiFMBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
def fill_radio(self, radio, fields):
|
||||
if 'current' in fields:
|
||||
if not radio.current:
|
||||
radio.current = AudioStreamInfo(0)
|
||||
radio.current = StreamInfo(0)
|
||||
radio.current.who, radio.current.what = self.get_current(radio.id)
|
||||
return radio
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
from weboob.capabilities.base import NotLoaded
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
from weboob.capabilities.radio import ICapRadio, Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
from weboob.capabilities.collection import ICapCollection, CollectionNotFound, Collection
|
||||
from weboob.tools.backend import BaseBackend
|
||||
|
||||
|
|
@ -180,7 +181,7 @@ class RadioFranceBackend(BaseBackend, ICapRadio, ICapCollection, ICapVideo):
|
|||
title = self.browser.get_current_rss(radio.id)
|
||||
if title:
|
||||
if not radio.current or radio.current is NotLoaded:
|
||||
radio.current = AudioStreamInfo(0)
|
||||
radio.current = StreamInfo(0)
|
||||
radio.current.what = title
|
||||
radio.current.who = artist
|
||||
return radio
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
import lxml.etree
|
||||
from weboob.capabilities.radio import ICapRadio, Radio
|
||||
from weboob.capabilities.audiostream import BaseAudioStream, AudioStreamInfo
|
||||
from weboob.capabilities.audiostream import BaseAudioStream
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
from weboob.capabilities.collection import ICapCollection
|
||||
from weboob.tools.backend import BaseBackend
|
||||
from weboob.tools.browser import StandardBrowser
|
||||
|
|
@ -69,7 +70,7 @@ class SomaFMBackend(BaseBackend, ICapRadio, ICapCollection):
|
|||
radio.description = channel.findtext('description')
|
||||
|
||||
current_data = channel.findtext('lastPlaying')
|
||||
current = AudioStreamInfo(0)
|
||||
current = StreamInfo(0)
|
||||
current.what, current.who = self._parse_current(current_data)
|
||||
radio.current = current
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue