diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-04-17 18:47:58 +0200 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-04-17 18:47:58 +0200 |
commit | be6027859c815e18b08a49ca1a45df3fc0aac301 (patch) | |
tree | e978249655fcab58f9ee1479c268ca8b06af7e8d /bsie/apps/index.py | |
parent | af81318ae9311fd0b0e16949cef3cfaf7996970b (diff) | |
parent | aefd0cb4fa1a949beabc51e88a5c46843043a439 (diff) | |
download | bsie-be6027859c815e18b08a49ca1a45df3fc0aac301.tar.gz bsie-be6027859c815e18b08a49ca1a45df3fc0aac301.tar.bz2 bsie-be6027859c815e18b08a49ca1a45df3fc0aac301.zip |
Merge branch 'mb/iptc' into develop
Diffstat (limited to 'bsie/apps/index.py')
-rw-r--r-- | bsie/apps/index.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/bsie/apps/index.py b/bsie/apps/index.py index d64e8c2..7dda6f4 100644 --- a/bsie/apps/index.py +++ b/bsie/apps/index.py @@ -6,7 +6,7 @@ import typing # bsie imports from bsie.lib import BSIE, DefaultNamingPolicy -from bsie.utils import bsfs, errors, node as node_ +from bsie.utils import bsfs, errors, node as node_, list_files # inner-module imports from . import _loader @@ -23,7 +23,7 @@ def main(argv): """Index files or directories into BSFS.""" parser = argparse.ArgumentParser(description=main.__doc__, prog='index') parser.add_argument('--config', type=str, - default=os.path.join(os.path.dirname(__file__), _loader.DEFAULT_CONFIG_FILE), + default=_loader.DEFAULT_CONFIG_FILE, help='Path to the config file.') parser.add_argument('--host', type=bsfs.URI, default=bsfs.URI('http://example.com'), help='') @@ -59,22 +59,9 @@ def main(argv): # FIXME: simplify code (below but maybe also above) # FIXME: How to handle dependencies between data? # E.g. do I still want to link to a tag despite not being permitted to set its label? - - # index input paths - for path in args.input_file: - if not os.path.exists(path): - pass # FIXME: notify the user - elif os.path.isdir(path) and args.recursive: - for dirpath, _, filenames in os.walk(path, topdown=True, followlinks=args.follow): - for filename in filenames: - for node, pred, value in bsie.from_file(os.path.join(dirpath, filename)): - handle(node, pred, value) - elif os.path.isfile(path): - for node, pred, value in bsie.from_file(path): - handle(node, pred, value) - else: - raise errors.UnreachableError() - + for path in list_files(args.input_file, args.recursive, args.follow): + for node, pred, value in bsie.from_file(path): + handle(node, pred, value) if args.print: walk(print) |