summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-10 11:28:28 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-10 11:28:28 +0100
commit442c37b7a9a912cf3b0eb972335b7d24407f4537 (patch)
tree295faea5f8cbd27a1e38a8cbfe2f6483d62d1dd8
parent04bbe41330a4c8619e6fa3228d47c4e7b0396899 (diff)
downloadyoutube-dl-442c37b7a9a912cf3b0eb972335b7d24407f4537.tar.gz
youtube-dl-442c37b7a9a912cf3b0eb972335b7d24407f4537.tar.xz
youtube-dl-442c37b7a9a912cf3b0eb972335b7d24407f4537.zip
[YoutubeDL] Do not perform filter matching on partial results (Fixes #4921)
-rwxr-xr-xyoutube_dl/YoutubeDL.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index e2ec55c90..13d18e25e 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -560,7 +560,7 @@ class YoutubeDL(object):
             self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')
             return None
 
-    def _match_entry(self, info_dict):
+    def _match_entry(self, info_dict, incomplete):
         """ Returns None iff the file should be downloaded """
 
         video_title = info_dict.get('title', info_dict.get('id', 'video'))
@@ -593,11 +593,12 @@ class YoutubeDL(object):
         if self.in_download_archive(info_dict):
             return '%s has already been recorded in archive' % video_title
 
-        match_filter = self.params.get('match_filter')
-        if match_filter is not None:
-            ret = match_filter(info_dict)
-            if ret is not None:
-                return ret
+        if not incomplete:
+            match_filter = self.params.get('match_filter')
+            if match_filter is not None:
+                ret = match_filter(info_dict)
+                if ret is not None:
+                    return ret
 
         return None
 
@@ -792,7 +793,7 @@ class YoutubeDL(object):
                     'extractor_key': ie_result['extractor_key'],
                 }
 
-                reason = self._match_entry(entry)
+                reason = self._match_entry(entry, incomplete=True)
                 if reason is not None:
                     self.to_screen('[download] ' + reason)
                     continue
@@ -1166,7 +1167,7 @@ class YoutubeDL(object):
         if 'format' not in info_dict:
             info_dict['format'] = info_dict['ext']
 
-        reason = self._match_entry(info_dict)
+        reason = self._match_entry(info_dict, incomplete=False)
         if reason is not None:
             self.to_screen('[download] ' + reason)
             return