Skip to content

Commit

Permalink
modified process_file() for a better "--no-overwrite" experience (#51)
Browse files Browse the repository at this point in the history
now re-occurring recursive directory calls are faster and with less WARN-ings
  • Loading branch information
kai-modrzok authored and amietn committed Jan 6, 2019
1 parent eb436cc commit 5816a45
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions vcsi/vcsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,18 @@ def process_file(path, args):
error_message = "File does not exist: {}".format(path)
error_exit(error_message)

if path.lower().endswith(args.image_format.lower()):
return

output_path = args.output_path
if not output_path:
output_path = path + "." + args.image_format

if args.no_overwrite:
if os.path.exists(output_path):
print("[INFO] contact-sheet already exists, skipping: {}".format(output_path))
return

print("Processing {}...".format(path))

media_info = MediaInfo(
Expand All @@ -1413,16 +1425,6 @@ def process_file(path, args):
frame_type=args.frame_type
)

output_path = args.output_path
if not output_path:
output_path = media_info.filename + "." + args.image_format

if args.no_overwrite:
if os.path.exists(output_path):
print("[WARN] Output file already exists, skipping: {}".format(output_path))
return


# metadata margins
if not args.metadata_margin == DEFAULT_METADATA_MARGIN:
args.metadata_horizontal_margin = args.metadata_margin
Expand Down

0 comments on commit 5816a45

Please sign in to comment.