Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual indicator for multiple URLs progress #19

Closed
Bfgeshka opened this issue Jun 8, 2017 · 5 comments
Closed

Visual indicator for multiple URLs progress #19

Bfgeshka opened this issue Jun 8, 2017 · 5 comments

Comments

@Bfgeshka
Copy link

Bfgeshka commented Jun 8, 2017

So it can be easier to keep track for how much links are processed already. Can be good for -i option.

Maybe something like that:

[N/XXX] input url

...

[N+1/XXX] input url

...

Or like that, always in the last line:

...

...

[N/XXX] input url

If it could be done, it should play along with -g option, ideally - use stderr instead of stdout.

@cryzed
Copy link

cryzed commented Jun 9, 2017

tqdm might be ideal for this if you don't want to reinvent the wheel: it's a tiny dependency and doesn't have any dependencies itself, outside of the stdlib. It even supports nesting progressbars, for example for the overall progress and current task progress. The default output for the progress is stderr too.

mikf added a commit that referenced this issue Jun 9, 2017
The output can be configured via the 'output.progress'
config value.

Possible values:
    - true:     Show the default progress indicator
                "[{current}/{total}] {url}" (default)
    - false:    Never show the progress indicator
    - <string>: Show the progress indicator using this
                as a custom format string(1).
                Possible replacement keys are:
                - current: current URL index
                - total  : total number of URLs
                - url    : current URL

(1) https://docs.python.org/3/library/string.html#formatstrings
@mikf
Copy link
Owner

mikf commented Jun 9, 2017

d5a70f2 basically implements your first example, which I quite like for its simplicity. You can also modify the progress indicator via the output.progress config value (see the commit message for more details).
You can, for example, use "\u001B]0;[{current}\/{total}] {url}\u0007" to put the indicator in the title of your terminal

@cryzed
Thanks for your suggestion, but I'd rather not use any extra dependencies if at all possible (except Requests). Maybe I'll come back to this in the future, but for right now 10 reinvented lines of code sound better to me than a 1k+ LOC dependency.

@cryzed
Copy link

cryzed commented Jun 10, 2017

Sure, no worries!

@Hrxn
Copy link
Contributor

Hrxn commented Jun 15, 2017

@Bfgeshka Did you test this? Is it how it's supposed to work?

@Bfgeshka
Copy link
Author

@Hrxn i did, it works good and in separate streams, just like it needs to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants