Pep8 Capa
This commit is contained in:
parent
b965e8222c
commit
d23d9672c6
3 changed files with 18 additions and 13 deletions
|
|
@ -20,11 +20,12 @@
|
|||
|
||||
from datetime import timedelta
|
||||
|
||||
from .base import IBaseCap, CapBaseObject,Field, StringField
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField
|
||||
from .file import ICapFile, BaseFile
|
||||
|
||||
|
||||
__all__ = ['BaseAudio','ICapAudio']
|
||||
__all__ = ['BaseAudio', 'ICapAudio']
|
||||
|
||||
|
||||
class BaseAudio(BaseFile):
|
||||
"""
|
||||
|
|
@ -32,14 +33,15 @@ class BaseAudio(BaseFile):
|
|||
"""
|
||||
ext = StringField('Audio file extension')
|
||||
duration = Field('Audio file duration', int, long, timedelta)
|
||||
bitrate = Field('Audio stream bit rate un Kbps',int)
|
||||
bitrate = Field('Audio stream bit rate un Kbps', int)
|
||||
format = StringField('Audio stream format')
|
||||
|
||||
|
||||
class ICapAudio(ICapFile):
|
||||
"""
|
||||
Audio file provider
|
||||
"""
|
||||
def search_audio(self,pattern,sortby=ICapFile.SEARCH_RELEVANCE):
|
||||
def search_audio(self, pattern, sortby=ICapFile.SEARCH_RELEVANCE):
|
||||
"""
|
||||
search for a audio file
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ class ICapAudio(ICapFile):
|
|||
:param sortby: sort by ...(use SEARCH_* constants)
|
||||
:rtype: iter[:class:`BaseAudio`]
|
||||
"""
|
||||
return self.search_file(pattern,sortby)
|
||||
return self.search_file(pattern, sortby)
|
||||
|
||||
def get_audio(self, id):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -25,14 +25,15 @@ from .file import ICapFile
|
|||
from .audio import ICapAudio, BaseAudio
|
||||
|
||||
|
||||
__all__ = ['AudioStreamInfo','BaseAudioStream','ICapAudioStream']
|
||||
__all__ = ['AudioStreamInfo', 'BaseAudioStream', 'ICapAudioStream']
|
||||
|
||||
|
||||
class AudioStreamInfo(CapBaseObject):
|
||||
"""
|
||||
AudioStream related information.
|
||||
"""
|
||||
who = StringField('Who is currently on air')
|
||||
what = StringField('What is currently on air')
|
||||
who = StringField('Who is currently on air')
|
||||
what = StringField('What is currently on air')
|
||||
|
||||
def __iscomplete__(self):
|
||||
# This volatile information may be reloaded everytimes.
|
||||
|
|
@ -49,7 +50,7 @@ class BaseAudioStream(BaseAudio):
|
|||
"""
|
||||
Audio stream object
|
||||
"""
|
||||
current = Field('Information related to current broadcast',AudioStreamInfo)
|
||||
current = Field('Information related to current broadcast', AudioStreamInfo)
|
||||
|
||||
def __unicode__(self):
|
||||
return u'%s (%s)' % (self.title, self.url)
|
||||
|
|
@ -57,6 +58,7 @@ class BaseAudioStream(BaseAudio):
|
|||
def __repr__(self):
|
||||
return self.__unicode__()
|
||||
|
||||
|
||||
class ICapAudioStream(ICapAudio):
|
||||
"""
|
||||
Audio streams provider
|
||||
|
|
@ -70,7 +72,7 @@ class ICapAudioStream(ICapAudio):
|
|||
:param sortby: sort by ... (use SEARCH_* constants)
|
||||
:rtype: iter[:class:`BaseAudioStream`]
|
||||
"""
|
||||
return self.search_audio(self,pattern,sortby)
|
||||
return self.search_audio(self, pattern, sortby)
|
||||
|
||||
def get_audiostream(self, id):
|
||||
"""
|
||||
|
|
@ -81,4 +83,3 @@ class ICapAudioStream(ICapAudio):
|
|||
:rtype: :class:`BaseAudioStream`
|
||||
"""
|
||||
return self.get_audio(self, id)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
from .base import IBaseCap, CapBaseObject, NotAvailable, Field, StringField, DateField
|
||||
|
||||
|
||||
__all__ = ['BaseFile','ICapFile']
|
||||
__all__ = ['BaseFile', 'ICapFile']
|
||||
|
||||
|
||||
class BaseFile(CapBaseObject):
|
||||
"""
|
||||
|
|
@ -49,6 +50,7 @@ class BaseFile(CapBaseObject):
|
|||
"""
|
||||
return self.id2url(self.id)
|
||||
|
||||
|
||||
class ICapFile(IBaseCap):
|
||||
"""
|
||||
Provide file download
|
||||
|
|
@ -58,7 +60,7 @@ class ICapFile(IBaseCap):
|
|||
SEARCH_VIEWS,
|
||||
SEARCH_DATE) = range(4)
|
||||
|
||||
def search_file(self,pattern,sortby=SEARCH_RELEVANCE):
|
||||
def search_file(self, pattern, sortby=SEARCH_RELEVANCE):
|
||||
"""
|
||||
:param pattern: pattern to search on
|
||||
:type pattern: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue