Add BaseOutput and DummyOutput

This commit is contained in:
Stein Magnus Jodal 2010-08-23 22:48:41 +02:00
parent 53aa64d52c
commit ea9385defe
2 changed files with 40 additions and 0 deletions

16
mopidy/outputs/base.py Normal file
View 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
View 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)