local: Review changes
This commit is contained in:
parent
4f7176cac8
commit
9794826f26
@ -85,11 +85,11 @@ To make a local library for your music available for Mopidy:
|
||||
#. Start Mopidy, find the music library in a client, and play some local music!
|
||||
|
||||
|
||||
Plugable library support
|
||||
------------------------
|
||||
Pluggable library support
|
||||
-------------------------
|
||||
|
||||
Local libraries are fully pluggable. What this means is that users may opt to
|
||||
disable the current default library `local-json`, replacing it with a third
|
||||
disable the current default library ``local-json``, replacing it with a third
|
||||
party one. When running :command:`mopidy local scan` mopidy will populate
|
||||
whatever the current active library is with data. Only one library may be
|
||||
active at a time.
|
||||
@ -115,8 +115,8 @@ Configuration values
|
||||
|
||||
.. confval:: local-json/enabled
|
||||
|
||||
If the local extension should be enabled or not.
|
||||
If the local-json extension should be enabled or not.
|
||||
|
||||
.. confval:: local-json/json_file
|
||||
|
||||
Path to a file to store the gziped json data in.
|
||||
Path to a file to store the GZiped JSON data in.
|
||||
|
||||
@ -428,18 +428,7 @@ solution you happen to prefer.
|
||||
super(SoundspotLibraryUpdateProvider, self).__init__(config)
|
||||
self.config = config
|
||||
|
||||
def load(self):
|
||||
# Your track loading code
|
||||
return tracks
|
||||
|
||||
def add(self, track):
|
||||
# Your code for handling adding a new track
|
||||
|
||||
def remove(self, uri):
|
||||
# Your code for removing the track coresponding to this uri
|
||||
|
||||
def commit(self):
|
||||
# Your code to persist the library, if needed.
|
||||
# Your library provider implementation here.
|
||||
|
||||
|
||||
Example GStreamer element
|
||||
|
||||
@ -17,13 +17,13 @@ def local_track_uri_to_file_uri(uri, media_dir):
|
||||
|
||||
def local_track_uri_to_path(uri, media_dir):
|
||||
if not uri.startswith('local:track:'):
|
||||
raise ValueError('Invalid uri.')
|
||||
raise ValueError('Invalid URI.')
|
||||
file_path = uri_to_path(uri).split(b':', 1)[1]
|
||||
return os.path.join(media_dir, file_path)
|
||||
|
||||
|
||||
def path_to_local_track_uri(relpath):
|
||||
"""Convert path releative to media_dir to local track uri"""
|
||||
"""Convert path releative to media_dir to local track URI."""
|
||||
if isinstance(relpath, unicode):
|
||||
relpath = relpath.encode('utf-8')
|
||||
return b'local:track:%s' % urllib.quote(relpath)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user