ext: Support multiple frontends/backends in an extension

This commit is contained in:
Stein Magnus Jodal 2013-04-01 11:30:07 +02:00
parent 0ec989d2cb
commit 64b0cc7b98
3 changed files with 12 additions and 12 deletions

View File

@ -265,13 +265,13 @@ meaningful defaults blank, like ``username`` and ``password``.
# You will typically only implement one of the next three methods
# in a single extension.
def get_frontend_class(self):
def get_frontend_classes(self):
from .frontend import SoundspotFrontend
return SoundspotFrontend
return [SoundspotFrontend]
def get_backend_class(self):
def get_backend_classes(self):
from .backend import SoundspotBackend
return SoundspotBackend
return [SoundspotBackend]
def register_gstreamer_elements(self):
from .mixer import SoundspotMixer

View File

@ -17,11 +17,11 @@ class Extension(object):
def validate_environment(self):
pass
def get_frontend_class(self):
pass
def get_frontend_classes(self):
return []
def get_backend_class(self):
pass
def get_backend_classes(self):
return []
def register_gstreamer_elements(self):
pass

View File

@ -24,11 +24,11 @@ class ExtensionTest(unittest.TestCase):
def test_validate_environment_does_nothing_by_default(self):
self.assertIsNone(self.ext.validate_environment())
def test_get_frontend_class_returns_none_by_default(self):
self.assertIsNone(self.ext.get_frontend_class())
def test_get_frontend_classes_returns_an_empty_list(self):
self.assertListEqual(self.ext.get_frontend_classes(), [])
def test_get_backend_class_returns_none_by_default(self):
self.assertIsNone(self.ext.get_backend_class())
def test_get_backend_classes_returns_an_empty_list(self):
self.assertListEqual(self.ext.get_backend_classes(), [])
def test_register_gstreamer_elements_does_nothing_by_default(self):
self.assertIsNone(self.ext.register_gstreamer_elements())