Skip to content

Commit

Permalink
add '-T/--terminate' command-line option (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jun 5, 2021
1 parent 6ecb710 commit dfe1e09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions gallery_dl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def main():
config.set((), "postprocessors", args.postprocessors)
if args.abort:
config.set((), "skip", "abort:" + str(args.abort))
if args.terminate:
config.set((), "skip", "terminate:" + str(args.terminate))
for opts in args.options:
config.set(*opts)

Expand Down
21 changes: 13 additions & 8 deletions gallery_dl/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@ def build_parser():
help=("Maximum number of retries for failed HTTP requests "
"or -1 for infinite retries (default: 4)"),
)
downloader.add_argument(
"-A", "--abort",
dest="abort", metavar="N", type=int,
help=("Abort extractor run after N consecutive file downloads have "
"been skipped, e.g. if files with the same filename already "
"exist"),
)
downloader.add_argument(
"--http-timeout",
dest="timeout", metavar="SECONDS", type=float, action=ConfigAction,
Expand Down Expand Up @@ -301,7 +294,19 @@ def build_parser():
"--download-archive",
dest="archive", metavar="FILE", action=ConfigAction,
help=("Record all downloaded files in the archive file and "
"skip downloading any file already in it."),
"skip downloading any file already in it"),
)
selection.add_argument(
"-A", "--abort",
dest="abort", metavar="N", type=int,
help=("Stop current extractor run "
"after N consecutive file downloads were skipped"),
)
selection.add_argument(
"-T", "--terminate",
dest="terminate", metavar="N", type=int,
help=("Stop current and parent extractor runs "
"after N consecutive file downloads were skipped"),
)
selection.add_argument(
"--range",
Expand Down

0 comments on commit dfe1e09

Please sign in to comment.