1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-24 11:42:58 +08:00

Add --socket-timeout option

This commit is contained in:
Philipp Hagemeister 2013-12-02 13:37:05 +01:00
parent a9be0cc736
commit 6ad14cab59
2 changed files with 7 additions and 1 deletions

View File

@ -971,7 +971,9 @@ class YoutubeDL(object):
write_string(u'[debug] Proxy map: ' + compat_str(proxy_map) + u'\n') write_string(u'[debug] Proxy map: ' + compat_str(proxy_map) + u'\n')
def _setup_opener(self): def _setup_opener(self):
timeout = float(self.params.get('socket_timeout', 600)) timeout_val = self.params.get('socket_timeout')
timeout = 600 if timeout_val is None else float(timeout_val)
opts_cookiefile = self.params.get('cookiefile') opts_cookiefile = self.params.get('cookiefile')
opts_proxy = self.params.get('proxy') opts_proxy = self.params.get('proxy')

View File

@ -198,6 +198,9 @@ def parseOpts(overrideArguments=None):
general.add_option( general.add_option(
'--no-cache-dir', action='store_const', const=None, dest='cachedir', '--no-cache-dir', action='store_const', const=None, dest='cachedir',
help='Disable filesystem caching') help='Disable filesystem caching')
general.add_option(
'--socket-timeout', dest='socket_timeout',
type=float, default=None, help=optparse.SUPPRESS_HELP)
selection.add_option('--playlist-start', selection.add_option('--playlist-start',
@ -652,6 +655,7 @@ def _real_main(argv=None):
'cookiefile': opts.cookiefile, 'cookiefile': opts.cookiefile,
'nocheckcertificate': opts.no_check_certificate, 'nocheckcertificate': opts.no_check_certificate,
'proxy': opts.proxy, 'proxy': opts.proxy,
'socket_timeout': opts.socket_timeout,
} }
with YoutubeDL(ydl_opts) as ydl: with YoutubeDL(ydl_opts) as ydl: