allejok96 / jw-scripts

Index or download videos and sound recordings from jw.org.
GNU General Public License v3.0
49 stars 10 forks source link

Download Speed Indicator #12

Closed ThinkDigitalSoftware closed 6 years ago

ThinkDigitalSoftware commented 6 years ago

Thank you SOOO much for making this. I was getting ready to try to tackle this, but I got stuck at fetching the URLs. I only spent 5 minutes before deciding to search GitHub and there you are! And it's written in Python. Love it! Thank you again. Can we get a download speed indicator? If I could figure out how to do pull requests, I'd look into figuring it out

allejok96 commented 6 years ago

I guess, since it calls the curl binary, simply removing the -s flag from the curl command would do it? Tell me, why do you want that info? Just nerdy statistics?

ThinkDigitalSoftware commented 6 years ago

Yup. Just nerdy statistics. I like to see some sort of progress indicator on any time consuming process so I know if there's an issue. I've been having some speed issues downloading videos from JW.org and I wanted to see if I was going to experience those here as well.

On Dec 7, 2017 10:53 PM, "Alex" notifications@github.com wrote:

I guess, since it calls the curl binary, simply removing the -s flag from the curl command would do it? Tell me, why do you want that info? Just nerdy statistics?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350188020, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfT4KdKB6SEIH2saxlMsugDo97bA7ks5s-N0GgaJpZM4Q6cG2 .

ThinkDigitalSoftware commented 6 years ago

Maybe that and a percentage as an optional flag? And if the program generates a list before starting, then a percentage of the total job list would also be nice if it's not too much. Kind of like rsync

On Dec 7, 2017 10:53 PM, "Alex" notifications@github.com wrote:

I guess, since it calls the curl binary, simply removing the -s flag from the curl command would do it? Tell me, why do you want that info? Just nerdy statistics?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350188020, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfT4KdKB6SEIH2saxlMsugDo97bA7ks5s-N0GgaJpZM4Q6cG2 .

ThinkDigitalSoftware commented 6 years ago

So with --progress-bar as the curl option, we get:

_downloading: 502017872_E_cnt_1_r720P.mp4 (Think Past the Drink) ######################################################################## 100.0% downloading: pk_E_029_r720P.mp4 (Be Humble) ######################################################################## 100.0% downloading: pkon_E_008r720P.mp4 (Journey With Jehovah’s Friends)

vs with just removing --silent

_downloading: 502017872_E_cnt_1_r720P.mp4 (Think Past the Drink) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 29.5M 100 29.5M 0 0 2752k 0 0:00:11 0:00:11 --:--:-- 2749k downloading: pk_E_029r720P.mp4 (Be Humble) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 25.3M 100 25.3M 0 0 2364k 0 0:00:11 0:00:11 --:--:-- 2317k

The latter does look a little messy, but I'd be fine with that being a user defined option. Maybe a --simple-progress and --verbose

allejok96 commented 6 years ago

While you're on it, does curl have some option of making it look nicer? If not, I'm not sure how this would be done, though I could probably figure something out, I just don't know if it is worth putting down the work...

ThinkDigitalSoftware commented 6 years ago

I only saw two options. There's a few libraries for progress bars. An interesting one is progressbar2 which has loads of options. The only thing you'd need to do is extract the info from curl to build the progress meter. As far is if it's worth it, I guess you can leave it with the basic progress meter unless someone asks for more. Or if you're up to it, both.

On Fri, Dec 8, 2017 at 1:54 AM Alex notifications@github.com wrote:

While you're on it, does curl have some option of making it look nicer? If not, I'm not sure how this would be done, though I could probably figure something out, I just don't know if it is worth putting down the work...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350221995, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfduRJLP1nwTuq8f1SYWJvHfc9H4hks5s-Qc4gaJpZM4Q6cG2 .

-- Think Digital 323-638-9448 760-678-8833 Facebook.com/ThinkDigitalRepair

ThinkDigitalSoftware commented 6 years ago

Also, there's a pycurl module if you are interested in using only python. Just found out. Haven't read all of the documentation yet to see if it supports progress bars.

On Fri, Dec 8, 2017 at 1:54 AM Alex notifications@github.com wrote:

While you're on it, does curl have some option of making it look nicer? If not, I'm not sure how this would be done, though I could probably figure something out, I just don't know if it is worth putting down the work...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350221995, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfduRJLP1nwTuq8f1SYWJvHfc9H4hks5s-Qc4gaJpZM4Q6cG2 .

-- Think Digital 323-638-9448 760-678-8833 Facebook.com/ThinkDigitalRepair

allejok96 commented 6 years ago

Thanks for your help. Replying on my phone, I didn't see that you suggested --progress-bar. That is great. I'll toss it in.

ThinkDigitalSoftware commented 6 years ago

Thanks! If you could add both and default to progress-bar, that would be perfect!

On Dec 8, 2017 1:23 PM, "Alex" notifications@github.com wrote:

Thanks for your help. Replying on my phone, I didn't see that you suggested --progress-bar. That is great. I'll toss it in.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350375437, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfVmubFTppUw22lSis_PovZ3EI9M-ks5s-ai9gaJpZM4Q6cG2 .

ThinkDigitalSoftware commented 6 years ago

I was going to submit a pull request but couldn't figure out how you parsed your args. I found the code, but haven't gotten to that level in my programming skill yet

On Dec 8, 2017 2:03 PM, "Jonathan White" thinkdigitalrepair@gmail.com wrote:

Thanks! If you could add both and default to progress-bar, that would be perfect!

On Dec 8, 2017 1:23 PM, "Alex" notifications@github.com wrote:

Thanks for your help. Replying on my phone, I didn't see that you suggested --progress-bar. That is great. I'll toss it in.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350375437, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfVmubFTppUw22lSis_PovZ3EI9M-ks5s-ai9gaJpZM4Q6cG2 .

allejok96 commented 6 years ago

Heh, yeah that's some special stuff going on there... The simplest way is using argparse at the top of jwb-index. The add_arguments function is just a thing by me to share arguments across the scripts....

I've just pushed a new version with the simplified progress bar on by default in the v1.3-beta branch.

I don't know about having a more verbose output.... Seems too cluttered. If you want to watch your download speed, why not use something like iftop assuming you're on *nix. Or with your programming skills, just remove --progress-bar from parse.py. But that's just my point of view. Do you have better reason?

ThinkDigitalSoftware commented 6 years ago

Nope. That's it. I can do that. Thanks for the explanation!

On Dec 9, 2017 4:43 AM, "Alex" notifications@github.com wrote:

Heh, yeah that's some special stuff going on there... The simplest way is using argparse https://docs.python.org/3/library/argparse.html?highlight=argparse#module-argparse at the top of jwb-index. The add_arguments function is just a thing by me to share arguments across the scripts....

I've just pushed a new version with the simplified progress bar on by default in the v1.3-beta branch.

I don't know about having a more verbose output.... Seems too cluttered. If you want to watch your download speed, why not use something like iftop assuming you're on *nix. Or with your programming skills, just remove --progress-bar from parse.py. But that's just my point of view. Do you have better reason?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allejok96/jw-scripts/issues/12#issuecomment-350459276, or mute the thread https://github.com/notifications/unsubscribe-auth/AV-HfQoE0swJhGOVnyl6URZJq_x5Kf1Yks5s-oCCgaJpZM4Q6cG2 .

allejok96 commented 6 years ago

Ok, great! I'll have to test this some more before pushing it into master.