CC-2279: Upgrade script for converting stor directory to new format

-refactor media-monitor
This commit is contained in:
martin 2011-07-13 17:38:11 -04:00
parent 5e7c763fbf
commit 29869c175a
6 changed files with 307 additions and 301 deletions

View file

@ -13,6 +13,7 @@ from multiprocessing import Process, Queue as mpQueue
from pyinotify import WatchManager
from airtimefilemonitor.airtimenotifier import AirtimeNotifier
from airtimefilemonitor.mediamonitorcommon import MediaMonitorCommon
from airtimefilemonitor.airtimeprocessevent import AirtimeProcessEvent
from airtimefilemonitor.mediaconfig import AirtimeMediaConfig
from airtimefilemonitor.workerprocess import MediaMonitorWorkerProcess
@ -60,13 +61,16 @@ except Exception, e:
logger.error('Exception: %s', e)
try:
wm = WatchManager()
pe = AirtimeProcessEvent(queue=multi_queue, airtime_config=config, wm=wm)
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client)
wm = WatchManager()
mmc = MediaMonitorCommon(config, wm)
pe = AirtimeProcessEvent(queue=multi_queue, airtime_config=config, wm=wm, mmc=mmc)
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
bootstrap.scan()
notifier = AirtimeNotifier(wm, pe, read_freq=1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap)
notifier = AirtimeNotifier(wm, pe, read_freq=1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
notifier.coalesce_events()
#create 5 worker processes
@ -76,7 +80,7 @@ try:
processes.append(p)
p.start()
wdd = pe.watch_directory(storage_directory)
wdd = mmc.watch_directory(storage_directory)
logger.info("Added watch to %s", storage_directory)
logger.info("wdd result %s", wdd[storage_directory])