Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
Check the extractor and profile file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mineo committed Apr 16, 2016
1 parent 7e3c6de commit 33922e3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions abzer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .abzer import Abzer
from os import cpu_count, walk
from os.path import isfile, join
from sys import exit


def collect_files(dir):
Expand All @@ -30,6 +31,13 @@ def read_config(filename):
return parser


def safety_check(config):
for filename in [config.get("essentia", "path"),
config.get("essentia", "profile")]:
if not isfile(filename):
exit("%s does not exist" % filename)


def main():
parser = argparse.ArgumentParser(prog="abzer",
formatter_class=argparse.ArgumentDefaultsHelpFormatter) # noqa
Expand Down Expand Up @@ -58,6 +66,8 @@ def main():
logging.exception("Could not read the configuration file.")
exit(1)

safety_check(config)

files = []

for name in args.filenames:
Expand All @@ -68,6 +78,7 @@ def main():

loop = asyncio.get_event_loop()
loop.set_debug(args.verbose)

abzer = Abzer(args.processes,
config.get("essentia", "path"),
config.get("essentia", "profile"),
Expand Down

0 comments on commit 33922e3

Please sign in to comment.