Add --load-info option (#972)
[youtube-dl] / youtube_dl / YoutubeDL.py
index b7393fd7983327c0df3d95f931d843967ca0a57e..80c056dc8215d7178a6dae023df5e2271add41ce 100644 (file)
@@ -812,6 +812,12 @@ class YoutubeDL(object):
 
         return self._download_retcode
 
+    def download_with_info_file(self, info_filename):
+        with open(info_filename, 'r') as f:
+            # TODO: Check for errors
+            info = json.load(f)
+        self.process_ie_result(info, download=True)
+
     def post_process(self, filename, ie_info):
         """Run all the postprocessors on the given file."""
         info = dict(ie_info)
@@ -971,7 +977,9 @@ class YoutubeDL(object):
         write_string(u'[debug] Proxy map: ' + compat_str(proxy_map) + u'\n')
 
     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_proxy = self.params.get('proxy')