ext/backend: Use utils.command directly.
Commands don't "belong" to backends or frontends so just leave it at an ext level and start using mopidy.utils.command directly.
This commit is contained in:
parent
63899059be
commit
5f5c6a841c
@ -2,8 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
|
||||
from mopidy.utils import command
|
||||
|
||||
|
||||
class Backend(object):
|
||||
#: Actor proxy to an instance of :class:`mopidy.audio.Audio`.
|
||||
@ -281,42 +279,3 @@ class BasePlaylistsProvider(object):
|
||||
*MUST be implemented by subclass.*
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
# Re-exporting from this location for backends.
|
||||
class Command(command.Command):
|
||||
pass
|
||||
|
||||
|
||||
# TODO: remove
|
||||
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``.
|
||||
|
||||
Will be converted to :type:`bytes` and should be limited to ASCII
|
||||
characters. 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, extensions):
|
||||
"""Run the sub-command implemented by this provider.
|
||||
|
||||
*MUST be implemented by subclass.*
|
||||
|
||||
:param args: the argments object from argparse
|
||||
:param config: read-only version of the mopidy config
|
||||
:param extensions: list of enabled extensions
|
||||
:returns: integer exit value for the process
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -6,21 +6,20 @@ import time
|
||||
|
||||
from mopidy import exceptions
|
||||
from mopidy.audio import scan
|
||||
from mopidy.backends import base
|
||||
from mopidy.utils import path
|
||||
from mopidy.utils import command, path
|
||||
|
||||
from . import translator
|
||||
|
||||
logger = logging.getLogger('mopidy.backends.local.scan')
|
||||
|
||||
|
||||
class LocalCommand(base.Command):
|
||||
class LocalCommand(command.Command):
|
||||
def __init__(self):
|
||||
super(LocalCommand, self).__init__()
|
||||
self.add_child('scan', ScanCommand())
|
||||
|
||||
|
||||
class ScanCommand(base.Command):
|
||||
class ScanCommand(command.Command):
|
||||
"""Scan local media files"""
|
||||
|
||||
def run(self, args, config, extensions):
|
||||
|
||||
@ -87,15 +87,12 @@ class Extension(object):
|
||||
"""
|
||||
return []
|
||||
|
||||
def get_sub_commads(self):
|
||||
# TODO: remove
|
||||
return []
|
||||
|
||||
def get_command(self):
|
||||
"""Command to expose to command line users running mopidy.
|
||||
|
||||
:returns:
|
||||
:class:`~mopidy.backends.base.Command` instance
|
||||
Instance of a :class:`~mopidy.utils.command.Command` class
|
||||
or sub-class.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user