mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-16 08:57:24 +08:00
Merge pull request #1 from singh-pratyush96/master
Added alias --min-sleep-interval and improved description of sleep arguments
This commit is contained in:
commit
24989672ee
@ -249,8 +249,11 @@ class YoutubeDL(object):
|
|||||||
source_address: (Experimental) Client-side IP address to bind to.
|
source_address: (Experimental) Client-side IP address to bind to.
|
||||||
call_home: Boolean, true iff we are allowed to contact the
|
call_home: Boolean, true iff we are allowed to contact the
|
||||||
youtube-dl servers for debugging.
|
youtube-dl servers for debugging.
|
||||||
sleep_interval: Number of seconds to sleep before each download.
|
sleep_interval: Minimum number of seconds to sleep before each download.
|
||||||
max_sleep_interval:Max number of random seconds to sleep.
|
Sleep will be for a random interval if --max-sleep-interval is also passed.
|
||||||
|
max_sleep_interval:Max number of seconds to sleep before each download.
|
||||||
|
Sleep will be for a random interval if passed along with --min-sleep-interval
|
||||||
|
or --sleep-interval, otherwise ignored.
|
||||||
listformats: Print an overview of available video formats and exit.
|
listformats: Print an overview of available video formats and exit.
|
||||||
list_thumbnails: Print a table of all thumbnails and exit.
|
list_thumbnails: Print a table of all thumbnails and exit.
|
||||||
match_filter: A function that gets called with the info_dict of
|
match_filter: A function that gets called with the info_dict of
|
||||||
|
@ -345,7 +345,7 @@ class FileDownloader(object):
|
|||||||
|
|
||||||
sleep_lower_bound = self.params.get('sleep_interval')
|
sleep_lower_bound = self.params.get('sleep_interval')
|
||||||
if sleep_lower_bound:
|
if sleep_lower_bound:
|
||||||
sleep_upper_bound = self.params.get('max_sleep_interval') if self.params.get('max_sleep_interval') else sleep_lower_bound
|
sleep_upper_bound = self.params.get('max_sleep_interval', sleep_lower_bound)
|
||||||
sleep_interval = random.uniform(sleep_lower_bound, sleep_upper_bound)
|
sleep_interval = random.uniform(sleep_lower_bound, sleep_upper_bound)
|
||||||
self.to_screen('[download] Sleeping %s seconds...' % sleep_interval)
|
self.to_screen('[download] Sleeping %s seconds...' % sleep_interval)
|
||||||
time.sleep(sleep_interval)
|
time.sleep(sleep_interval)
|
||||||
|
@ -499,13 +499,16 @@ def parseOpts(overrideArguments=None):
|
|||||||
dest='bidi_workaround', action='store_true',
|
dest='bidi_workaround', action='store_true',
|
||||||
help='Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
help='Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--sleep-interval', metavar='SECONDS',
|
'--sleep-interval', '--min-sleep-interval', metavar='SECONDS',
|
||||||
dest='sleep_interval', type=float,
|
dest='sleep_interval', type=float,
|
||||||
help='Number of seconds to sleep before each download.')
|
help='Minimum number of seconds to sleep before each download. Sleep will be for a random interval if '
|
||||||
|
'--max-sleep-interval is also passed.'
|
||||||
|
)
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--max-sleep-interval', metavar='SECONDS',
|
'--max-sleep-interval', metavar='SECONDS',
|
||||||
dest='max_sleep_interval', type=float,
|
dest='max_sleep_interval', type=float,
|
||||||
help='Max number of random seconds to sleep.'
|
help='Max number of seconds to sleep before each download. Sleep will be for a random interval if passed'
|
||||||
|
' along with --min-sleep-interval or --sleep-interval, otherwise ignored.'
|
||||||
)
|
)
|
||||||
|
|
||||||
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user