From 4638d245d44c121ad6d649ab4d09404beef2e8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Mon, 9 Sep 2013 23:08:42 +0200 Subject: [PATCH] modify ICapRadio to use ICapAudioStream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- weboob/capabilities/radio.py | 41 +++++------------------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/weboob/capabilities/radio.py b/weboob/capabilities/radio.py index 67be4f4f..8f021f51 100644 --- a/weboob/capabilities/radio.py +++ b/weboob/capabilities/radio.py @@ -1,6 +1,7 @@ # -*- 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. # @@ -19,41 +20,10 @@ from .base import IBaseCap, CapBaseObject, Field, StringField +from .audiostream import AudioStreamInfo, ICapAudioStream, BaseAudioStream -__all__ = ['Emission', 'Stream', '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__() +__all__ = ['Radio', 'ICapRadio'] class Radio(CapBaseObject): @@ -62,10 +32,9 @@ class Radio(CapBaseObject): """ title = StringField('Title of radio') description = StringField('Description of radio') - current = Field('Current emission', Emission) + current = Field('Current emission', AudioStreamInfo) streams = Field('List of streams', list) - class ICapRadio(IBaseCap): """ Capability of radio websites.