cc-4105: add last_ran method for config object. added more comments

This commit is contained in:
Rudi Grinberg 2012-07-23 17:16:51 -04:00
parent d10ca3046d
commit bbe56bcdc3
2 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import copy
from configobj import ConfigObj
from media.monitor.exceptions import NoConfigFile, ConfigAccessViolation
import media.monitor.pure as mmp
class MMConfig(object):
def __init__(self, path):
@ -27,6 +28,9 @@ class MMConfig(object):
def save(self): self.cfg.write()
def last_ran(self):
return mmp.last_modified(self.cfg['index_path'])
# Remove this after debugging...
def haxxor_set(self, key, value): self.cfg[key] = value
def haxxor_get(self, key): return self.cfg[key]

View File

@ -92,8 +92,11 @@ problem_files = ProblemFileHandler(channel=channels['badfile'])
# A slight incosistency here, channels['watch'] is already a list while the
# other items are single elements. For consistency we should make all the
# values in channels lists later on
# like now
bs = Bootstrapper(db=sdb, last_ran=mmp.last_modified(config['index_path']), org_channels=[channels['org']], watch_channels=channels['watch'])
# we try to not share the config object as much as possible and in this case we
# prefer to only pass the necessary last_ran parameter instead of the whole
# object. although this might change in the future if Bootstrapper becomes more
# complicated
bs = Bootstrapper(db=sdb, last_ran=config.last_ran(), org_channels=[channels['org']], watch_channels=channels['watch'])
bs.flush_organize()
bs.flush_watch()