cc-4105: added docs. removed unused method
This commit is contained in:
parent
12a5edfd5c
commit
6238424113
|
@ -112,9 +112,6 @@ class AirtimeMessageReceiver(Loggable):
|
||||||
self.logger.error( traceback.format_exc() )
|
self.logger.error( traceback.format_exc() )
|
||||||
raise DirectoryIsNotListed(directory)
|
raise DirectoryIsNotListed(directory)
|
||||||
|
|
||||||
def supported_messages(self):
|
|
||||||
return self.dispatch_table.keys()
|
|
||||||
|
|
||||||
def md_update(self, msg):
|
def md_update(self, msg):
|
||||||
self.logger.info("Updating metadata for: '%s'" %
|
self.logger.info("Updating metadata for: '%s'" %
|
||||||
msg['MDATA_KEY_FILEPATH'])
|
msg['MDATA_KEY_FILEPATH'])
|
||||||
|
|
|
@ -3,6 +3,10 @@ from media.monitor.log import Loggable
|
||||||
from media.monitor.toucher import RepeatTimer
|
from media.monitor.toucher import RepeatTimer
|
||||||
|
|
||||||
class EventDrainer(Loggable):
|
class EventDrainer(Loggable):
|
||||||
|
"""
|
||||||
|
Flushes events from RabbitMQ that are sent from airtime every
|
||||||
|
certain amount of time
|
||||||
|
"""
|
||||||
def __init__(self, connection, interval=1):
|
def __init__(self, connection, interval=1):
|
||||||
def cb():
|
def cb():
|
||||||
try: connection.drain_events(timeout=0.3)
|
try: connection.drain_events(timeout=0.3)
|
||||||
|
|
|
@ -94,14 +94,23 @@ class Manager(Loggable):
|
||||||
recorded_path=recorded_path)
|
recorded_path=recorded_path)
|
||||||
|
|
||||||
def get_problem_files_path(self):
|
def get_problem_files_path(self):
|
||||||
|
"""
|
||||||
|
returns the path where problem files should go
|
||||||
|
"""
|
||||||
return self.organize['problem_files_path']
|
return self.organize['problem_files_path']
|
||||||
|
|
||||||
def set_problem_files_path(self, new_path):
|
def set_problem_files_path(self, new_path):
|
||||||
|
"""
|
||||||
|
Set the path where problem files should go
|
||||||
|
"""
|
||||||
self.organize['problem_files_path'] = new_path
|
self.organize['problem_files_path'] = new_path
|
||||||
self.organize['problem_handler'] = \
|
self.organize['problem_handler'] = \
|
||||||
ProblemFileHandler( PathChannel(signal='badfile',path=new_path) )
|
ProblemFileHandler( PathChannel(signal='badfile',path=new_path) )
|
||||||
|
|
||||||
def get_recorded_path(self):
|
def get_recorded_path(self):
|
||||||
|
"""
|
||||||
|
returns the path of the recorded directory
|
||||||
|
"""
|
||||||
return self.organize['recorded_path']
|
return self.organize['recorded_path']
|
||||||
|
|
||||||
def set_recorded_path(self, new_path):
|
def set_recorded_path(self, new_path):
|
||||||
|
|
|
@ -102,7 +102,6 @@ class TimeoutWatcher(threading.Thread,Loggable):
|
||||||
|
|
||||||
class WatchSyncer(ReportHandler,Loggable):
|
class WatchSyncer(ReportHandler,Loggable):
|
||||||
def __init__(self, signal, chunking_number = 100, timeout=15):
|
def __init__(self, signal, chunking_number = 100, timeout=15):
|
||||||
#self.signal = signal
|
|
||||||
self.timeout = float(timeout)
|
self.timeout = float(timeout)
|
||||||
self.chunking_number = int(chunking_number)
|
self.chunking_number = int(chunking_number)
|
||||||
self.__reset_queue()
|
self.__reset_queue()
|
||||||
|
|
|
@ -16,12 +16,9 @@ class TestReceiver(unittest.TestCase):
|
||||||
cfg = {}
|
cfg = {}
|
||||||
self.amr = AirtimeMessageReceiver(cfg, Manager())
|
self.amr = AirtimeMessageReceiver(cfg, Manager())
|
||||||
|
|
||||||
def test_supported_messages(self):
|
|
||||||
self.assertTrue( len(self.amr.supported_messages()) > 0 )
|
|
||||||
|
|
||||||
def test_supported(self):
|
def test_supported(self):
|
||||||
# Every supported message should fire something
|
# Every supported message should fire something
|
||||||
for event_type in self.amr.supported_messages():
|
for event_type in self.amr.dispatch_tables.keys():
|
||||||
msg = { 'event_type' : event_type, 'extra_param' : 123 }
|
msg = { 'event_type' : event_type, 'extra_param' : 123 }
|
||||||
filtered = filter_ev(msg)
|
filtered = filter_ev(msg)
|
||||||
# There should be a better way to test the following without
|
# There should be a better way to test the following without
|
||||||
|
|
Loading…
Reference in New Issue