modify ICapRadio to use ICapAudioStream
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
edd015107e
commit
4638d245d4
1 changed files with 5 additions and 36 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010-2011 Romain Bignon
|
# Copyright(C) 2010-2013 Romain Bignon
|
||||||
|
# Copyright(C) 2013 Pierre Mazière
|
||||||
#
|
#
|
||||||
# This file is part of weboob.
|
# This file is part of weboob.
|
||||||
#
|
#
|
||||||
|
|
@ -19,41 +20,10 @@
|
||||||
|
|
||||||
|
|
||||||
from .base import IBaseCap, CapBaseObject, Field, StringField
|
from .base import IBaseCap, CapBaseObject, Field, StringField
|
||||||
|
from .audiostream import AudioStreamInfo, ICapAudioStream, BaseAudioStream
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Emission', 'Stream', 'Radio', 'ICapRadio']
|
__all__ = ['Radio', 'ICapRadio']
|
||||||
|
|
||||||
|
|
||||||
class Emission(CapBaseObject):
|
|
||||||
"""
|
|
||||||
Emission of a radio.
|
|
||||||
"""
|
|
||||||
artist = StringField('Name of artist')
|
|
||||||
title = StringField('Title of song or emission')
|
|
||||||
|
|
||||||
def __iscomplete__(self):
|
|
||||||
# This volatile information may be reloaded everytimes.
|
|
||||||
return False
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
if self.artist:
|
|
||||||
return u'%s - %s' % (self.artist, self.title)
|
|
||||||
else:
|
|
||||||
return self.title
|
|
||||||
|
|
||||||
|
|
||||||
class Stream(CapBaseObject):
|
|
||||||
"""
|
|
||||||
Stream of a radio.
|
|
||||||
"""
|
|
||||||
title = StringField('Title of stream')
|
|
||||||
url = StringField('Direct URL to the stream')
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return u'%s (%s)' % (self.title, self.url)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return self.__unicode__()
|
|
||||||
|
|
||||||
|
|
||||||
class Radio(CapBaseObject):
|
class Radio(CapBaseObject):
|
||||||
|
|
@ -62,10 +32,9 @@ class Radio(CapBaseObject):
|
||||||
"""
|
"""
|
||||||
title = StringField('Title of radio')
|
title = StringField('Title of radio')
|
||||||
description = StringField('Description of radio')
|
description = StringField('Description of radio')
|
||||||
current = Field('Current emission', Emission)
|
current = Field('Current emission', AudioStreamInfo)
|
||||||
streams = Field('List of streams', list)
|
streams = Field('List of streams', list)
|
||||||
|
|
||||||
|
|
||||||
class ICapRadio(IBaseCap):
|
class ICapRadio(IBaseCap):
|
||||||
"""
|
"""
|
||||||
Capability of radio websites.
|
Capability of radio websites.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue