Merge pull request #636 from jodal/feature/move-backends

Move backends out of mopidy.backends
This commit is contained in:
Thomas Adamcik 2014-01-11 09:02:51 -08:00
commit ff4c965aff
31 changed files with 40 additions and 48 deletions

View File

@ -52,6 +52,5 @@ Backend listener
Backend implementations Backend implementations
======================= =======================
* :mod:`mopidy.backends.dummy` * :mod:`mopidy.local`
* :mod:`mopidy.backends.local` * :mod:`mopidy.stream`
* :mod:`mopidy.backends.stream`

View File

@ -708,9 +708,9 @@ throughout Mopidy.
**Stream backend** **Stream backend**
We've added a new backend for playing audio streams, the :mod:`stream backend We've added a new backend for playing audio streams, the :mod:`stream backend
<mopidy.backends.stream>`. It is activated by default. The stream backend <mopidy.stream>`. It is activated by default. The stream backend supports the
supports the intersection of what your GStreamer installation supports and what intersection of what your GStreamer installation supports and what protocols
protocols are included in the :attr:`mopidy.settings.STREAM_PROTOCOLS` setting. are included in the :attr:`mopidy.settings.STREAM_PROTOCOLS` setting.
Current limitations: Current limitations:

View File

@ -18,7 +18,7 @@ None. The extension just needs Mopidy.
Default configuration Default configuration
===================== =====================
.. literalinclude:: ../../mopidy/backends/local/ext.conf .. literalinclude:: ../../mopidy/local/ext.conf
:language: ini :language: ini
@ -105,7 +105,7 @@ whatever the current active library is with data. Only one library may be
active at a time. active at a time.
To create a new library provider you must create class that implements the To create a new library provider you must create class that implements the
:class:`~mopidy.backends.local.Libary` interface and install it in the :class:`~mopidy.local.Library` interface and install it in the extension
extension registry under ``local:library``. Any data that the library needs registry under ``local:library``. Any data that the library needs to store on
to store on disc should be stored in :confval:`local/data_dir` using the disc should be stored in :confval:`local/data_dir` using the library name as
library name as part of the filename or directory to avoid any conflicts. part of the filename or directory to avoid any conflicts.

View File

@ -20,7 +20,7 @@ None. The extension just needs Mopidy.
Default configuration Default configuration
===================== =====================
.. literalinclude:: ../../mopidy/backends/stream/ext.conf .. literalinclude:: ../../mopidy/stream/ext.conf
:language: ini :language: ini

View File

@ -7,9 +7,8 @@ import os
import tempfile import tempfile
import mopidy import mopidy
from mopidy import models from mopidy import local, models
from mopidy.backends import local from mopidy.local import search
from mopidy.backends.local import search
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -42,9 +42,9 @@ setup(
], ],
'mopidy.ext': [ 'mopidy.ext': [
'http = mopidy.http:Extension [http]', 'http = mopidy.http:Extension [http]',
'local = mopidy.backends.local:Extension', 'local = mopidy.local:Extension',
'mpd = mopidy.mpd:Extension', 'mpd = mopidy.mpd:Extension',
'stream = mopidy.backends.stream:Extension', 'stream = mopidy.stream:Extension',
], ],
}, },
classifiers=[ classifiers=[

View File

@ -6,14 +6,15 @@ import unittest
import pykka import pykka
from mopidy import core from mopidy import core
from mopidy.backends import dummy
from mopidy.models import Track from mopidy.models import Track
from tests import dummy_backend
@mock.patch.object(core.CoreListener, 'send') @mock.patch.object(core.CoreListener, 'send')
class BackendEventsTest(unittest.TestCase): class BackendEventsTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.backend = dummy.create_dummy_backend_proxy() self.backend = dummy_backend.create_dummy_backend_proxy()
self.core = core.Core.start(backends=[self.backend]).proxy() self.core = core.Core.start(backends=[self.backend]).proxy()
def tearDown(self): def tearDown(self):

View File

@ -2,16 +2,6 @@
This backend implements the backend API in the simplest way possible. It is This backend implements the backend API in the simplest way possible. It is
used in tests of the frontends. used in tests of the frontends.
The backend handles URIs starting with ``dummy:``.
**Dependencies**
None
**Default config**
None
""" """
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -5,9 +5,9 @@ import unittest
import mock import mock
import pykka import pykka
from mopidy import core, audio from mopidy import audio, core
from mopidy.backends import listener from mopidy.backends import listener
from mopidy.backends.local import actor from mopidy.local import actor
from tests import path_to_data_dir from tests import path_to_data_dir

View File

@ -8,7 +8,7 @@ import unittest
import pykka import pykka
from mopidy import core from mopidy import core
from mopidy.backends.local import actor, json from mopidy.local import actor, json
from mopidy.models import Track, Album, Artist from mopidy.models import Track, Album, Artist
from tests import path_to_data_dir from tests import path_to_data_dir

View File

@ -7,12 +7,12 @@ import unittest
import pykka import pykka
from mopidy import audio, core from mopidy import audio, core
from mopidy.backends.local import actor
from mopidy.core import PlaybackState from mopidy.core import PlaybackState
from mopidy.local import actor
from mopidy.models import Track from mopidy.models import Track
from tests import path_to_data_dir from tests import path_to_data_dir
from tests.backends.local import generate_song, populate_tracklist from tests.local import generate_song, populate_tracklist
# TODO Test 'playlist repeat', e.g. repeat=1,single=0 # TODO Test 'playlist repeat', e.g. repeat=1,single=0

View File

@ -8,11 +8,11 @@ import unittest
import pykka import pykka
from mopidy import audio, core from mopidy import audio, core
from mopidy.backends.local import actor from mopidy.local import actor
from mopidy.models import Playlist, Track from mopidy.models import Playlist, Track
from tests import path_to_data_dir from tests import path_to_data_dir
from tests.backends.local import generate_song from tests.local import generate_song
class LocalPlaylistsProviderTest(unittest.TestCase): class LocalPlaylistsProviderTest(unittest.TestCase):

View File

@ -6,12 +6,12 @@ import unittest
import pykka import pykka
from mopidy import audio, core from mopidy import audio, core
from mopidy.backends.local import actor
from mopidy.core import PlaybackState from mopidy.core import PlaybackState
from mopidy.local import actor
from mopidy.models import Playlist, TlTrack, Track from mopidy.models import Playlist, TlTrack, Track
from tests import path_to_data_dir from tests import path_to_data_dir
from tests.backends.local import generate_song, populate_tracklist from tests.local import generate_song, populate_tracklist
class LocalTracklistProviderTest(unittest.TestCase): class LocalTracklistProviderTest(unittest.TestCase):

View File

@ -6,7 +6,7 @@ import os
import tempfile import tempfile
import unittest import unittest
from mopidy.backends.local.translator import parse_m3u from mopidy.local.translator import parse_m3u
from mopidy.models import Track from mopidy.models import Track
from mopidy.utils.path import path_to_uri from mopidy.utils.path import path_to_uri

View File

@ -5,11 +5,12 @@ import unittest
import pykka import pykka
from mopidy import core from mopidy import core
from mopidy.backends import dummy
from mopidy.mpd.dispatcher import MpdDispatcher from mopidy.mpd.dispatcher import MpdDispatcher
from mopidy.mpd.exceptions import MpdAckError from mopidy.mpd.exceptions import MpdAckError
from mopidy.mpd.protocol import request_handlers, handle_request from mopidy.mpd.protocol import request_handlers, handle_request
from tests import dummy_backend
class MpdDispatcherTest(unittest.TestCase): class MpdDispatcherTest(unittest.TestCase):
def setUp(self): def setUp(self):
@ -18,7 +19,7 @@ class MpdDispatcherTest(unittest.TestCase):
'password': None, 'password': None,
} }
} }
self.backend = dummy.create_dummy_backend_proxy() self.backend = dummy_backend.create_dummy_backend_proxy()
self.core = core.Core.start(backends=[self.backend]).proxy() self.core = core.Core.start(backends=[self.backend]).proxy()
self.dispatcher = MpdDispatcher(config=config) self.dispatcher = MpdDispatcher(config=config)

View File

@ -6,9 +6,10 @@ import unittest
import pykka import pykka
from mopidy import core from mopidy import core
from mopidy.backends import dummy
from mopidy.mpd import session from mopidy.mpd import session
from tests import dummy_backend
class MockConnection(mock.Mock): class MockConnection(mock.Mock):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -31,7 +32,7 @@ class BaseTestCase(unittest.TestCase):
} }
def setUp(self): def setUp(self):
self.backend = dummy.create_dummy_backend_proxy() self.backend = dummy_backend.create_dummy_backend_proxy()
self.core = core.Core.start(backends=[self.backend]).proxy() self.core = core.Core.start(backends=[self.backend]).proxy()
self.connection = MockConnection() self.connection = MockConnection()

View File

@ -5,12 +5,12 @@ import unittest
import pykka import pykka
from mopidy import core from mopidy import core
from mopidy.backends import dummy
from mopidy.core import PlaybackState from mopidy.core import PlaybackState
from mopidy.models import Track
from mopidy.mpd import dispatcher from mopidy.mpd import dispatcher
from mopidy.mpd.protocol import status from mopidy.mpd.protocol import status
from mopidy.models import Track
from tests import dummy_backend
PAUSED = PlaybackState.PAUSED PAUSED = PlaybackState.PAUSED
PLAYING = PlaybackState.PLAYING PLAYING = PlaybackState.PLAYING
@ -22,7 +22,7 @@ STOPPED = PlaybackState.STOPPED
class StatusHandlerTest(unittest.TestCase): class StatusHandlerTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.backend = dummy.create_dummy_backend_proxy() self.backend = dummy_backend.create_dummy_backend_proxy()
self.core = core.Core.start(backends=[self.backend]).proxy() self.core = core.Core.start(backends=[self.backend]).proxy()
self.dispatcher = dispatcher.MpdDispatcher(core=self.core) self.dispatcher = dispatcher.MpdDispatcher(core=self.core)
self.context = self.dispatcher.context self.context = self.dispatcher.context

View File

@ -7,9 +7,10 @@ import unittest
import pykka import pykka
from mopidy import core, models from mopidy import core, models
from mopidy.backends import dummy
from mopidy.utils import jsonrpc from mopidy.utils import jsonrpc
from tests import dummy_backend
class Calculator(object): class Calculator(object):
def model(self): def model(self):
@ -40,7 +41,7 @@ class Calculator(object):
class JsonRpcTestBase(unittest.TestCase): class JsonRpcTestBase(unittest.TestCase):
def setUp(self): def setUp(self):
self.backend = dummy.create_dummy_backend_proxy() self.backend = dummy_backend.create_dummy_backend_proxy()
self.core = core.Core.start(backends=[self.backend]).proxy() self.core = core.Core.start(backends=[self.backend]).proxy()
self.jrw = jsonrpc.JsonRpcWrapper( self.jrw = jsonrpc.JsonRpcWrapper(