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

Scheduled --rate-limit / download stop #2031

Closed
alimirjamali opened this issue Dec 22, 2013 · 4 comments
Closed

Scheduled --rate-limit / download stop #2031

alimirjamali opened this issue Dec 22, 2013 · 4 comments

Comments

@alimirjamali
Copy link
Contributor

@alimirjamali alimirjamali commented Dec 22, 2013

I suggest Youtube-DL code should have a mechanism to schedule speed-limit, also scheduled stop/start.

Some users might have download caps during days, yet unlimited download cap during night hours.

I have a friend who executes Youtube-DL at his office in the afternoons in order to download a long list of videos (for education purposes of course!!!). He does not want to annoy other users the next morning because of Youtube-DL, hogging the entire bandwidth! He can not be sure if the download would be finished by next morning. Since he visits his office only in the afternoons, manual control is not an option.

I had to write a custom Python script for him to address that issue. Yet I believe, it would be a nice option for original Youtube-DL code/API.

Most of suggested code could be integrated in FileDownloader.py, somewhere in _do_download function, Line 632:680

With best regards,
Ali

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 23, 2013

I personally think that's better done as an external script (just kill the youtube-dl process when you want and resume the download the next day), so that youtube-dl doesn't get more complicated.

@alimirjamali
Copy link
Contributor Author

@alimirjamali alimirjamali commented Dec 23, 2013

Hi @jaimeMF

I agree that it is currently complicated since you are rewriting the entire FileDownloader to it's own module.

Killing & resuming the process is possible from an external script. Changing the rate-limit is not possible (at last during downloading a huge video). It know is possible to kill the the process, reset ratelimit variable and resume. However, this is not a beautiful way of coding.

Adding options such as "--rate-limit-start" / "--rate-limit-stop" is relatively easy. Few lines in "slow_down" function to check whether speed limiting should be enforced or not. Two variables will be required to store ratelimitstart time and ratelimitstop time. Some coding will be necessary in the main program to check if those options are set and store them in the mentioned variables. Some documentation will be needed.

Anyway, this is just a suggestion. The youtube-dl code is already very good and I do not want to over-complicate things. It is essential to keep a balance between reliability / functionality and simplicity.

Best regards,
Ali

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 23, 2013

It's just my opinion. If you want, you can open a pull request with your suggested changes and we will look into it.

@alimirjamali
Copy link
Contributor Author

@alimirjamali alimirjamali commented Dec 23, 2013

OK, I will act accordingly.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.