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 datetime import timedelta
|
||||||
|
|
||||||
from .base import IBaseCap, CapBaseObject,Field, StringField
|
from .base import IBaseCap, CapBaseObject, Field, StringField
|
||||||
from .file import ICapFile, BaseFile
|
from .file import ICapFile, BaseFile
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BaseAudio','ICapAudio']
|
__all__ = ['BaseAudio', 'ICapAudio']
|
||||||
|
|
||||||
|
|
||||||
class BaseAudio(BaseFile):
|
class BaseAudio(BaseFile):
|
||||||
"""
|
"""
|
||||||
|
|
@ -32,14 +33,15 @@ class BaseAudio(BaseFile):
|
||||||
"""
|
"""
|
||||||
ext = StringField('Audio file extension')
|
ext = StringField('Audio file extension')
|
||||||
duration = Field('Audio file duration', int, long, timedelta)
|
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')
|
format = StringField('Audio stream format')
|
||||||
|
|
||||||
|
|
||||||
class ICapAudio(ICapFile):
|
class ICapAudio(ICapFile):
|
||||||
"""
|
"""
|
||||||
Audio file provider
|
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
|
search for a audio file
|
||||||
|
|
||||||
|
|
@ -48,7 +50,7 @@ class ICapAudio(ICapFile):
|
||||||
:param sortby: sort by ...(use SEARCH_* constants)
|
:param sortby: sort by ...(use SEARCH_* constants)
|
||||||
:rtype: iter[:class:`BaseAudio`]
|
:rtype: iter[:class:`BaseAudio`]
|
||||||
"""
|
"""
|
||||||
return self.search_file(pattern,sortby)
|
return self.search_file(pattern, sortby)
|
||||||
|
|
||||||
def get_audio(self, id):
|
def get_audio(self, id):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ from .file import ICapFile
|
||||||
from .audio import ICapAudio, BaseAudio
|
from .audio import ICapAudio, BaseAudio
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['AudioStreamInfo','BaseAudioStream','ICapAudioStream']
|
__all__ = ['AudioStreamInfo', 'BaseAudioStream', 'ICapAudioStream']
|
||||||
|
|
||||||
|
|
||||||
class AudioStreamInfo(CapBaseObject):
|
class AudioStreamInfo(CapBaseObject):
|
||||||
"""
|
"""
|
||||||
|
|
@ -49,7 +50,7 @@ class BaseAudioStream(BaseAudio):
|
||||||
"""
|
"""
|
||||||
Audio stream object
|
Audio stream object
|
||||||
"""
|
"""
|
||||||
current = Field('Information related to current broadcast',AudioStreamInfo)
|
current = Field('Information related to current broadcast', AudioStreamInfo)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s (%s)' % (self.title, self.url)
|
return u'%s (%s)' % (self.title, self.url)
|
||||||
|
|
@ -57,6 +58,7 @@ class BaseAudioStream(BaseAudio):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.__unicode__()
|
return self.__unicode__()
|
||||||
|
|
||||||
|
|
||||||
class ICapAudioStream(ICapAudio):
|
class ICapAudioStream(ICapAudio):
|
||||||
"""
|
"""
|
||||||
Audio streams provider
|
Audio streams provider
|
||||||
|
|
@ -70,7 +72,7 @@ class ICapAudioStream(ICapAudio):
|
||||||
:param sortby: sort by ... (use SEARCH_* constants)
|
:param sortby: sort by ... (use SEARCH_* constants)
|
||||||
:rtype: iter[:class:`BaseAudioStream`]
|
:rtype: iter[:class:`BaseAudioStream`]
|
||||||
"""
|
"""
|
||||||
return self.search_audio(self,pattern,sortby)
|
return self.search_audio(self, pattern, sortby)
|
||||||
|
|
||||||
def get_audiostream(self, id):
|
def get_audiostream(self, id):
|
||||||
"""
|
"""
|
||||||
|
|
@ -81,4 +83,3 @@ class ICapAudioStream(ICapAudio):
|
||||||
:rtype: :class:`BaseAudioStream`
|
:rtype: :class:`BaseAudioStream`
|
||||||
"""
|
"""
|
||||||
return self.get_audio(self, id)
|
return self.get_audio(self, id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
from .base import IBaseCap, CapBaseObject, NotAvailable, Field, StringField, DateField
|
from .base import IBaseCap, CapBaseObject, NotAvailable, Field, StringField, DateField
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BaseFile','ICapFile']
|
__all__ = ['BaseFile', 'ICapFile']
|
||||||
|
|
||||||
|
|
||||||
class BaseFile(CapBaseObject):
|
class BaseFile(CapBaseObject):
|
||||||
"""
|
"""
|
||||||
|
|
@ -49,6 +50,7 @@ class BaseFile(CapBaseObject):
|
||||||
"""
|
"""
|
||||||
return self.id2url(self.id)
|
return self.id2url(self.id)
|
||||||
|
|
||||||
|
|
||||||
class ICapFile(IBaseCap):
|
class ICapFile(IBaseCap):
|
||||||
"""
|
"""
|
||||||
Provide file download
|
Provide file download
|
||||||
|
|
@ -58,7 +60,7 @@ class ICapFile(IBaseCap):
|
||||||
SEARCH_VIEWS,
|
SEARCH_VIEWS,
|
||||||
SEARCH_DATE) = range(4)
|
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
|
:param pattern: pattern to search on
|
||||||
:type pattern: str
|
:type pattern: str
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue