ext/backends: Add get_sub_commands and BaseSubCommandProvider
This commit is contained in:
parent
7144876dc5
commit
518cac5eab
@ -279,3 +279,34 @@ class BasePlaylistsProvider(object):
|
||||
*MUST be implemented by subclass.*
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class BaseSubCommandProvider(object):
|
||||
"""Sub-classes may optionally add arguments to the passed in parser.
|
||||
|
||||
:param parser: parser you may add arguments to
|
||||
:type parser: :class:`argparse.ArgumentParser`
|
||||
"""
|
||||
|
||||
name = None
|
||||
"""What the sub-command should be called. Will be run as ``mopidy NAME``
|
||||
|
||||
Example: ``scan``
|
||||
"""
|
||||
|
||||
help = None
|
||||
"""Optional help text for the sub-command, will be displayed in help."""
|
||||
|
||||
def __init__(self, parser):
|
||||
pass
|
||||
|
||||
def run(self, args, config):
|
||||
"""Run the sub-command implemented by this provider.
|
||||
|
||||
*MUST be implemented by subclass.*
|
||||
|
||||
:param args: the argments object from argpase.
|
||||
:param config: read only version of the mopidy config.
|
||||
:returns: integer exit value for the process.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -87,6 +87,14 @@ class Extension(object):
|
||||
"""
|
||||
return []
|
||||
|
||||
def get_sub_commands(self):
|
||||
"""List of sub-command classes
|
||||
|
||||
:returns: list of
|
||||
:class:`~mopidy.backends.base.BaseSubCommandProvider` subclasses
|
||||
"""
|
||||
return []
|
||||
|
||||
def register_gstreamer_elements(self):
|
||||
"""Hook for registering custom GStreamer elements
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user