move cache/config/update handling before loading extractors
This commit is contained in:
@@ -157,10 +157,37 @@ def main():
|
||||
|
||||
log.debug("Configuration Files %s", config._files)
|
||||
|
||||
if args.clear_cache:
|
||||
from . import cache
|
||||
log = logging.getLogger("cache")
|
||||
cnt = cache.clear(args.clear_cache)
|
||||
|
||||
if cnt is None:
|
||||
log.error("Database file not available")
|
||||
return 1
|
||||
|
||||
log.info("Deleted %d entr%s from '%s'",
|
||||
cnt, "y" if cnt == 1 else "ies", cache._path())
|
||||
return 0
|
||||
|
||||
if args.config:
|
||||
if args.config == "init":
|
||||
return config.initialize()
|
||||
elif args.config == "status":
|
||||
return config.status()
|
||||
else:
|
||||
return config.open_extern()
|
||||
|
||||
if args.print_traffic:
|
||||
import requests
|
||||
requests.packages.urllib3.connection.HTTPConnection.debuglevel = 1
|
||||
|
||||
if args.update:
|
||||
from . import update
|
||||
extr = update.UpdateExtractor.from_url("update:" + args.update)
|
||||
ujob = update.UpdateJob(extr)
|
||||
return ujob.run()
|
||||
|
||||
# extractor modules
|
||||
modules = config.get(("extractor",), "modules")
|
||||
if modules is not None:
|
||||
@@ -199,13 +226,7 @@ def main():
|
||||
else:
|
||||
extractor._module_iter = iter(modules[0])
|
||||
|
||||
if args.update:
|
||||
from . import update
|
||||
extr = update.UpdateExtractor.from_url("update:" + args.update)
|
||||
ujob = update.UpdateJob(extr)
|
||||
return ujob.run()
|
||||
|
||||
elif args.list_modules:
|
||||
if args.list_modules:
|
||||
extractor.modules.append("")
|
||||
sys.stdout.write("\n".join(extractor.modules))
|
||||
|
||||
@@ -228,28 +249,6 @@ def main():
|
||||
extr.example,
|
||||
))
|
||||
|
||||
elif args.clear_cache:
|
||||
from . import cache
|
||||
log = logging.getLogger("cache")
|
||||
cnt = cache.clear(args.clear_cache)
|
||||
|
||||
if cnt is None:
|
||||
log.error("Database file not available")
|
||||
return 1
|
||||
else:
|
||||
log.info(
|
||||
"Deleted %d %s from '%s'",
|
||||
cnt, "entry" if cnt == 1 else "entries", cache._path(),
|
||||
)
|
||||
|
||||
elif args.config:
|
||||
if args.config == "init":
|
||||
return config.initialize()
|
||||
elif args.config == "status":
|
||||
return config.status()
|
||||
else:
|
||||
return config.open_extern()
|
||||
|
||||
else:
|
||||
input_files = config.get((), "input-files")
|
||||
if input_files:
|
||||
|
||||
Reference in New Issue
Block a user