allows more possibilities for the match filter options

This commit is contained in:
gillouche 2016-03-02 21:42:47 +01:00
parent 8c5a994424
commit c99f4bd3d3
3 changed files with 29 additions and 2 deletions

View File

@ -144,7 +144,15 @@ which means you can modify it, redistribute it or use it however you like.
functionality is not available at the given
service), but who also have a description,
use --match-filter "like_count > 100 &
dislike_count <? 50 & description" .
dislike_count <? 50 & description". If
strings containing spaces need to be
compared, there is no need to surround them
with delimiters like quotes inside the
match-filter string. The whole string will
be evaluated. For example, the youtube
playlist 'Liked videos' will not be
downloaded with the following filter :
--match-filter "playlist_title != Liked videos"
--no-playlist Download only the video, if the URL refers
to a video and a playlist.
--yes-playlist Download the playlist, if the URL refers to

View File

@ -694,6 +694,25 @@ ffmpeg version 2.4.4 Copyright (c) 2000-2014 the FFmpeg ...'''), '2.4.4')
self.assertFalse(match_str(
'like_count > 100 & dislike_count <? 50 & description',
{'like_count': 190, 'dislike_count': 10}))
self.assertTrue(match_str(
'playlist_title != some playlist with space',
{'playlist_title': 'playlist'}))
self.assertFalse(match_str(
'playlist_title != some playlist with space',
{'playlist_title': 'some playlist with space'}))
self.assertFalse(match_str(
'playlist_title != some_playlist_without_space',
{'playlist_title': 'some_playlist_without_space'}))
self.assertTrue(match_str(
'playlist_title != some playlist with space & playlist_title != some_playlist',
{'playlist_title': 'playlist'}))
self.assertFalse(match_str(
'playlist_title != some playlist with space & playlist_title != some_playlist',
{'playlist_title': 'some_playlist'}))
self.assertTrue(match_str(
'playlist_title != some-playlist_name & playlist_title != some_playlist-name',
{'playlist_title': 'some_playlist'}))
def test_parse_dfxp_time_expr(self):
self.assertEqual(parse_dfxp_time_expr(None), None)

View File

@ -1962,7 +1962,7 @@ def _match_one(filter_part, dct):
\s*(?P<op>%s)(?P<none_inclusive>\s*\?)?\s*
(?:
(?P<intval>[0-9.]+(?:[kKmMgGtTpPeEzZyY]i?[Bb]?)?)|
(?P<strval>(?![0-9.])[a-z0-9A-Z]*)
(?P<strval>(?![0-9.])[a-z0-9A-Z\s_-]*)
)
\s*$
''' % '|'.join(map(re.escape, COMPARISON_OPERATORS.keys())))