mopidy_podcast.directory
A PodcastDirectory
provides access to collections (also termed directories in Mopidy), podcasts and episodes, possibly via an external directory service. Each PodcastDirectory
instance manages its own private namespace of URI references, all starting with an absolute path and optionally containg a query string and fragment identifier. The URI reference /
specifies the root of a podcast directory, and any two podcast directories may use the same URI reference, e.g. /Music?topPodcasts
, for different resources.
A PodcastDirectory
may also register one or more URI schemes via the uri_schemes
attribute. For example, the feeds directory bundled with Mopidy-Podcast already registers the file
, ftp
, http
and https
schemes, assuming URIs with these schemes point to podcast RSS feeds. By returning an absolute URI with one of these schemes, a podcast directory actually delegates retrieving and parsing the respective resource to the feeds directory.
PodcastDirectory
name
Subclasses must override this attribute with a string starting with an ASCII character and consisting solely of ASCII characters, digits and hyphens (-
).
root_name
Subclasses must override this attribute if they implement the browse
method.
uri_schemes
Subclasses that provide support for additional URI schemes must implement the get
method for the specified schemes, and must also support absolute URIs in their browse
and search
methods.
Note that the file
, ftp
, http
and https
schemes are already handled by the feeds directory implementation.
get
uri is an absolute URI corresponding to one of the configured uri_schemes
.
If a subclass does not override uri_schemes
, this method need not be implemented.
- param string uri
podcast URI
- rtype
mopidy_podcast.models.Podcast
browse
uri may be either a URI reference starting with /
, or an absolute URI with one of the configured uri_schemes
.
limit specifies the maximum number of objects to return, or None
if no such limit is given.
Returns a list of mopidy_podcast.models.Ref
objects for the directories, podcasts and episodes at the given uri.
- param string uri
browse URI
- param int limit
browse limit
- rtype
mopidy_podcast.models.Ref
iterable
search
uri may be either a URI reference starting with /
, or an absolute URI with one of the configured uri_schemes
.
terms is a list of strings specifying search terms.
attr may be an attribute name which must be matched, or None
if any attribute may match terms.
type, if given, specifies the type of items to search for, and must be either mopidy_podcast.models.Ref.PODCAST
or mopidy_podcast.models.Ref.EPISODE
.
limit specifies the maximum number of objects to return, or None
if no such limit is given.
Returns a list of mopidy_podcast.models.Ref
objects for the matching podcasts and episodes found at the given uri.
- param string uri
browse URI
- param terms
search terms
- type terms
list of strings
- param string attr
search attribute
- param string type
search result type
- param int limit
search limit
- rtype
mopidy_podcast.models.Ref
iterable
refresh
This method is called right after __init__
and should be used to perform potentially time-consuming initialization, such as retrieving data from a Web site.
This method may also be called periodically as a request to update any locally cached data.
- param string uri
refresh URI