cc-4105: add last_ran method for config object. added more comments
This commit is contained in:
parent
d10ca3046d
commit
bbe56bcdc3
|
@ -4,6 +4,7 @@ import copy
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
||||||
from media.monitor.exceptions import NoConfigFile, ConfigAccessViolation
|
from media.monitor.exceptions import NoConfigFile, ConfigAccessViolation
|
||||||
|
import media.monitor.pure as mmp
|
||||||
|
|
||||||
class MMConfig(object):
|
class MMConfig(object):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
|
@ -27,6 +28,9 @@ class MMConfig(object):
|
||||||
|
|
||||||
def save(self): self.cfg.write()
|
def save(self): self.cfg.write()
|
||||||
|
|
||||||
|
def last_ran(self):
|
||||||
|
return mmp.last_modified(self.cfg['index_path'])
|
||||||
|
|
||||||
# Remove this after debugging...
|
# Remove this after debugging...
|
||||||
def haxxor_set(self, key, value): self.cfg[key] = value
|
def haxxor_set(self, key, value): self.cfg[key] = value
|
||||||
def haxxor_get(self, key): return self.cfg[key]
|
def haxxor_get(self, key): return self.cfg[key]
|
||||||
|
|
|
@ -92,8 +92,11 @@ problem_files = ProblemFileHandler(channel=channels['badfile'])
|
||||||
# A slight incosistency here, channels['watch'] is already a list while the
|
# A slight incosistency here, channels['watch'] is already a list while the
|
||||||
# other items are single elements. For consistency we should make all the
|
# other items are single elements. For consistency we should make all the
|
||||||
# values in channels lists later on
|
# values in channels lists later on
|
||||||
# like now
|
# we try to not share the config object as much as possible and in this case we
|
||||||
bs = Bootstrapper(db=sdb, last_ran=mmp.last_modified(config['index_path']), org_channels=[channels['org']], watch_channels=channels['watch'])
|
# 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_organize()
|
||||||
bs.flush_watch()
|
bs.flush_watch()
|
||||||
|
|
Loading…
Reference in New Issue