Skip to content

Commit 02b419e

Browse files
committed
handles only one file specified
if only one file is specified it goes in INPUT_DIR
1 parent 74bdb67 commit 02b419e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

discogsxml2db/exporter.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def main(arguments):
314314
except Exception:
315315
pass
316316

317-
if arguments['INPUT_DIR']:
317+
if arguments["INPUT_DIR"] and os.path.isdir(arguments["INPUT_DIR"]):
318318
# use --export to select the entities
319319
in_base = arguments['INPUT_DIR']
320320
for entity in arguments['--export']:
@@ -328,8 +328,13 @@ def main(arguments):
328328
max_hint=min(expected_count, limit or expected_count),
329329
dry_run=dry_run)
330330
exporter.export()
331-
elif arguments["<INPUT_FILE>"]:
332-
for in_file in arguments["<INPUT_FILE>"]:
331+
elif arguments["<INPUT_FILE>"] or os.path.isfile(arguments["INPUT_DIR"]):
332+
files = []
333+
if arguments["<INPUT_FILE>"]:
334+
files = arguments["<INPUT_FILE>"]
335+
else:
336+
files = [ arguments["INPUT_DIR"] ]
337+
for in_file in files:
333338
for entity in _exporters:
334339
# discogs files are named discogs_{date}_{entity}s.xml
335340
if f"_{entity}" in in_file:

0 commit comments

Comments
 (0)