Add BaseOutput and DummyOutput
This commit is contained in:
parent
53aa64d52c
commit
ea9385defe
16
mopidy/outputs/base.py
Normal file
16
mopidy/outputs/base.py
Normal file
@ -0,0 +1,16 @@
|
||||
class BaseOutput(object):
|
||||
"""
|
||||
Base class for audio outputs.
|
||||
"""
|
||||
|
||||
def start(self):
|
||||
"""Start the output."""
|
||||
pass
|
||||
|
||||
def destroy(self):
|
||||
"""Destroy the output."""
|
||||
pass
|
||||
|
||||
def process_message(self, message):
|
||||
"""Process messages with the output as destination."""
|
||||
raise NotImplementedError
|
||||
24
mopidy/outputs/dummy.py
Normal file
24
mopidy/outputs/dummy.py
Normal file
@ -0,0 +1,24 @@
|
||||
from mopidy.outputs.base import BaseOutput
|
||||
|
||||
class DummyOutput(BaseOutput):
|
||||
"""
|
||||
Audio output used for testing.
|
||||
"""
|
||||
|
||||
#: For testing. :class:`True` if :meth:`start` has been called.
|
||||
start_called = False
|
||||
|
||||
#: For testing. :class:`True` if :meth:`destroy` has been called.
|
||||
destroy_called = False
|
||||
|
||||
#: For testing. Contains all messages :meth:`process_message` has received.
|
||||
messages = []
|
||||
|
||||
def start(self):
|
||||
self.start_called = True
|
||||
|
||||
def destroy(self):
|
||||
self.destroy_called = True
|
||||
|
||||
def process_message(self, message):
|
||||
self.messages.append(message)
|
||||
Loading…
Reference in New Issue
Block a user