Added full browsing, playlist and search support.

This commit is contained in:
Frederick Gnodtke 2016-09-18 18:19:08 +02:00
parent a73edeae8e
commit d8cbb503a5
6 changed files with 137 additions and 70 deletions

View file

@ -6,6 +6,7 @@ PLAYLIST = 'playlist'
ALBUM = 'album'
PREFIX = 'subidy'
ROOT = 'root'
SEARCH = 'search'
ROOT_URI = '%s:%s' % (PREFIX, ROOT)
@ -17,6 +18,9 @@ def is_type_result_valid(result):
def is_id_result_valid(result, type):
return is_type_result_valid(result) and result.group(1) == PREFIX and result.group(2) == type
def is_uri(uri):
return regex.match(uri) is not None
def get_song_id(uri):
result = regex.match(uri)
if not is_id_result_valid(result, SONG):
@ -58,3 +62,9 @@ def get_album_uri(id):
def get_song_uri(id):
return get_type_uri(SONG, id)
def get_playlist_uri(id):
return get_type_uri(PLAYLIST, id)
def get_search_uri(query):
return get_type_uri(SEARCH, query)