Added progress counter, #601
This commit is contained in:
@@ -1896,10 +1896,12 @@ def export(
|
|||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
photo_num = 0
|
||||||
# send progress bar output to /dev/null if verbose to hide the progress bar
|
# send progress bar output to /dev/null if verbose to hide the progress bar
|
||||||
fp = open(os.devnull, "w") if verbose else None
|
fp = open(os.devnull, "w") if verbose else None
|
||||||
with click.progressbar(photos, file=fp) as bar:
|
with click.progressbar(photos, show_pos=True, file=fp) as bar:
|
||||||
for p in bar:
|
for p in bar:
|
||||||
|
photo_num += 1
|
||||||
export_results = export_photo(
|
export_results = export_photo(
|
||||||
photo=p,
|
photo=p,
|
||||||
dest=dest,
|
dest=dest,
|
||||||
@@ -1946,6 +1948,8 @@ def export(
|
|||||||
export_preview=preview,
|
export_preview=preview,
|
||||||
preview_suffix=preview_suffix,
|
preview_suffix=preview_suffix,
|
||||||
preview_if_missing=preview_if_missing,
|
preview_if_missing=preview_if_missing,
|
||||||
|
photo_num=photo_num,
|
||||||
|
num_photos=num_photos,
|
||||||
)
|
)
|
||||||
|
|
||||||
if post_function:
|
if post_function:
|
||||||
@@ -2624,6 +2628,8 @@ def export_photo(
|
|||||||
export_preview=False,
|
export_preview=False,
|
||||||
preview_suffix=None,
|
preview_suffix=None,
|
||||||
preview_if_missing=False,
|
preview_if_missing=False,
|
||||||
|
photo_num=1,
|
||||||
|
num_photos=1,
|
||||||
):
|
):
|
||||||
"""Helper function for export that does the actual export
|
"""Helper function for export that does the actual export
|
||||||
|
|
||||||
@@ -2668,6 +2674,8 @@ def export_photo(
|
|||||||
export_preview: export the preview image generated by Photos
|
export_preview: export the preview image generated by Photos
|
||||||
preview_suffix: str, template to use as suffix for preview images
|
preview_suffix: str, template to use as suffix for preview images
|
||||||
preview_if_missing: bool, export preview if original is missing
|
preview_if_missing: bool, export preview if original is missing
|
||||||
|
photo_num: int, which number photo in total of num_photos is being exported
|
||||||
|
num_photos: int, total number of photos that will be exported
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list of path(s) of exported photo or None if photo was missing
|
list of path(s) of exported photo or None if photo was missing
|
||||||
@@ -2789,7 +2797,7 @@ def export_photo(
|
|||||||
original_filename = str(original_filename)
|
original_filename = str(original_filename)
|
||||||
|
|
||||||
verbose_(
|
verbose_(
|
||||||
f"Exporting {photo.original_filename} ({photo.filename}) as {original_filename}"
|
f"Exporting {photo.original_filename} ({photo.filename}) as {original_filename} ({photo_num}/{num_photos})"
|
||||||
)
|
)
|
||||||
|
|
||||||
results += export_photo_to_directory(
|
results += export_photo_to_directory(
|
||||||
|
|||||||
Reference in New Issue
Block a user