[f4m] Download only the first fragment with the `--test` option
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 15 Feb 2014 16:09:49 +0000 (17:09 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 15 Feb 2014 16:53:23 +0000 (17:53 +0100)
youtube_dl/downloader/f4m.py
youtube_dl/extractor/syfy.py

index 052751106d9b29a73800d50410e8525c12a3bcb6..2a870a758fa32dd475eaf725f69dedbf3c45903b 100644 (file)
@@ -224,7 +224,13 @@ class F4mFD(FileDownloader):
         self.to_screen('[download] Downloading f4m manifest')
         manifest = self.ydl.urlopen(man_url).read()
         self.report_destination(filename)
-        http_dl = HttpQuietDownloader(self.ydl, {'continuedl': True, 'quiet': True, 'noprogress': True})
+        http_dl = HttpQuietDownloader(self.ydl,
+            {
+                'continuedl': True,
+                'quiet': True,
+                'noprogress': True,
+                'test': self.params.get('test', False),
+            })
 
         doc = etree.fromstring(manifest)
         formats = [(int(f.attrib.get('bitrate', -1)), f) for f in doc.findall(_add_ns('media'))]
@@ -235,6 +241,9 @@ class F4mFD(FileDownloader):
         metadata = base64.b64decode(media.find(_add_ns('metadata')).text)
         boot_info = read_bootstrap_info(bootstrap)
         fragments_list = build_fragments_list(boot_info)
+        if self.params.get('test', False):
+            # We only download the first fragment
+            fragments_list = fragments_list[:1]
         total_frags = len(fragments_list)
 
         tmpfilename = self.temp_name(filename)
index 502d43ec462666136e403c1a6f61d5e3b26303fb..8809a57fe31d23ea081e553302ef38222fb02221 100644 (file)
@@ -10,16 +10,13 @@ class SyfyIE(InfoExtractor):
 
     _TEST = {
         'url': 'http://www.syfy.com/videos/Robot%20Combat%20League/Behind%20the%20Scenes/vid:2631458',
+        'md5': 'e07de1d52c7278adbb9b9b1c93a66849',
         'info_dict': {
             'id': 'NmqMrGnXvmO1',
             'ext': 'flv',
             'title': 'George Lucas has Advice for his Daughter',
             'description': 'Listen to what insights George Lucas give his daughter Amanda.',
         },
-        'params': {
-            # f4m download
-            'skip_download': True,
-        },
         'add_ie': ['ThePlatform'],
     }