For details on how to use Mopidy’s local backend, see Mopidy-Local.
Local library interface.
Extensions that wish to provide an alternate local library storage backend need to sub-class this class and install and configure it with an extension. Both scanning and library calls will use the active local library.
Parameters: | config – Config dictionary |
---|
URI of the local backend’s root directory.
This constant should be used by libraries implementing the Library.browse() method.
Add the given track to library. Optional args will only be added if add_supports_tags_and_duration has been set.
Parameters: |
|
---|
Feature marker to indicate that you want add() calls to be called with optional arguments tags and duration.
Prepare library for accepting updates. Exactly what this means is highly implementation depended. This must however return an iterator that generates all tracks in the library for efficient scanning.
Return type: | Track iterator |
---|
Browse directories and tracks at the given URI.
The URI for the root directory is a constant available at Library.ROOT_DIRECTORY_URI.
Parameters: | path (string) – URI to browse. |
---|---|
Return type: | List of Ref tracks and directories. |
Clear out whatever data storage is used by this backend.
Return type: | Boolean indicating if state was cleared. |
---|
Called for every n-th track indicating that work should be committed. Sub-classes are free to ignore these hints.
Return type: | Boolean indicating if state was flushed. |
---|
List distinct values for a given field from the library.
Parameters: |
|
---|---|
Return type: | set of values corresponding to the requested field type. |
Lookup the images for the given URIs.
The default implementation will simply call lookup() and try and use the album art for any tracks returned. Most local libraries should replace this with something smarter or simply return an empty dictionary.
Parameters: | uris (list) – list of URIs to find images for |
---|---|
Return type: | {uri: tuple of mopidy.models.Image} |
(Re)load any tracks stored in memory, if any, otherwise just return number of available tracks currently available. Will be called at startup for both library and update use cases, so if you plan to store tracks in memory this is when the should be (re)loaded.
Return type: | int representing number of tracks in library. |
---|
Lookup the given URI.
Parameters: | uri (string) – track URI |
---|---|
Return type: | list of Track (or single Track for backward compatibility) |
Name of the local library implementation, must be overriden.
Remove the given track from the library.
Parameters: | uri (str) – URI to remove from the library/ |
---|
Search the library for tracks where field contains values.
Parameters: |
|
---|---|
Return type: |
Convert local track or directory URI to file URI.
Convert local track or directory URI to absolute path.
Convert path relative to local/media_dir directory URI.
Convert path relative to local/media_dir to local track URI.