Mopidy-Podcast Directory Provider

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.

class mopidy_podcast.directory.PodcastDirectory(config)

Podcast directory provider.

name = None

Name of the podcast directory implementation.

Subclasses must override this attribute with a string starting with an ASCII character and consisting solely of ASCII characters, digits and hyphens (-).

root_name = None

Name of the root directory for browsing.

Subclasses must override this attribute if they implement the browse() method.

uri_schemes = []

List of URI schemes the directory can handle.

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)

Return a podcast for the given uri.

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.

Parameters:uri (string) – podcast URI
Return type:mopidy_podcast.models.Podcast
browse(uri, limit=None)

Browse directories, podcasts and episodes at the given uri.

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.

Parameters:
  • uri (string) – browse URI
  • limit (int) – browse limit
Return type:

mopidy_podcast.models.Ref iterable

search(uri, terms, attr=None, type=None, limit=None)

Search podcasts and episodes at the given uri for terms.

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.

Parameters:
  • uri (string) – browse URI
  • terms (list of strings) – search terms
  • attr (string) – search attribute
  • type (string) – search result type
  • limit (int) – search limit
Return type:

mopidy_podcast.models.Ref iterable

refresh(uri=None)

Refresh the podcast directory.

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.

Parameters:uri (string) – refresh URI