move id parsing from application to capability

This commit is contained in:
Bezleputh 2014-02-18 23:13:06 +01:00 committed by Florent
commit b6fd529249
2 changed files with 16 additions and 9 deletions

View file

@ -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