move id parsing from application to capability
This commit is contained in:
parent
ee8e72f51c
commit
b6fd529249
2 changed files with 16 additions and 9 deletions
|
|
@ -301,16 +301,9 @@ class Radioob(ReplApplication):
|
|||
except (IndexError, ValueError):
|
||||
pass
|
||||
|
||||
m = re.match('^(\w+)\.(.*)', _id)
|
||||
m = ICapAudio.get_object_method(_id)
|
||||
if m:
|
||||
if m.group(1) == 'album':
|
||||
return self.get_object(_id, 'get_album')
|
||||
|
||||
elif m.group(1) == 'playlist':
|
||||
return self.get_object(_id, 'get_playlist')
|
||||
|
||||
else:
|
||||
return self.get_object(_id, 'get_audio')
|
||||
return self.get_object(_id, m)
|
||||
|
||||
return self.get_object(_id, 'get_radio')
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,20 @@ class ICapAudio(ICapFile):
|
|||
"""
|
||||
Audio file provider
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def get_object_method(cls, _id):
|
||||
m = re.match('^(\w+)\.(.*)', _id)
|
||||
if m:
|
||||
if m.group(1) == 'album':
|
||||
return 'get_album'
|
||||
|
||||
elif m.group(1) == 'playlist':
|
||||
return 'get_playlist'
|
||||
|
||||
else:
|
||||
return 'get_audio'
|
||||
|
||||
def search_audio(self, pattern, sortby=ICapFile.SEARCH_RELEVANCE):
|
||||
"""
|
||||
search for a audio file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue