[downloader/external] add can_download mathod for checking downloader availibilty...
authorremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 13:53:17 +0000 (14:53 +0100)
committerremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 14:18:51 +0000 (15:18 +0100)
youtube_dl/downloader/__init__.py
youtube_dl/downloader/external.py

index 67c2840a58f08ea31834ccfc6b54cde5d0592789..daa5498d4a10b521cb9d09f9c23633888e69bec2 100644 (file)
@@ -31,13 +31,13 @@ def get_suitable_downloader(info_dict, params={}):
     protocol = determine_protocol(info_dict)
     info_dict['protocol'] = protocol
 
-    if (info_dict.get('start_time') or info_dict.get('end_time')) and FFmpegFD.available() and FFmpegFD.supports(info_dict):
+    if (info_dict.get('start_time') or info_dict.get('end_time')) and FFmpegFD.can_download(info_dict):
         return FFmpegFD
 
     external_downloader = params.get('external_downloader')
     if external_downloader is not None:
         ed = get_external_downloader(external_downloader)
-        if ed.available() and ed.supports(info_dict):
+        if ed.can_download(info_dict):
             return ed
 
     if protocol == 'm3u8' and params.get('hls_prefer_native'):
index daedf66de0016076a579ce15d53ca71b39cfceb6..fe2a0198c27348746b5341853638ef4c094d2781 100644 (file)
@@ -59,6 +59,10 @@ class ExternalFD(FileDownloader):
     def supports(cls, info_dict):
         return info_dict['protocol'] in ('http', 'https', 'ftp', 'ftps')
 
+    @classmethod
+    def can_download(cls, info_dict):
+        return cls.available() and cls.supports(info_dict)
+
     def _option(self, command_option, param):
         return cli_option(self.params, command_option, param)