diff --git a/mopidy/outputs/base.py b/mopidy/outputs/base.py new file mode 100644 index 00000000..0e2cabfe --- /dev/null +++ b/mopidy/outputs/base.py @@ -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 diff --git a/mopidy/outputs/dummy.py b/mopidy/outputs/dummy.py new file mode 100644 index 00000000..26c750ae --- /dev/null +++ b/mopidy/outputs/dummy.py @@ -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)