aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-06-28 22:08:29 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-06-28 22:31:35 +0200
commit67134eaba1a56cec4117000acb2fc9284c9cdd9a (patch)
tree0ea043d651dd54fcc2dc7d1114e00242073ba469 /youtube_dl/compat.py
parentac0474f89d3e6f8c8c1fb3223a16a18a2fd02bcb (diff)
[YoutubeDL] rework how the format spec is processed
The spec string is processed using 'tokenize.tokenize' to split it in words and operators, the filters are still processed using regular expressions. This should make easier to allow grouping operators with parens.
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index f9529210d..bc218dd71 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -388,6 +388,10 @@ else:
pass
return _terminal_size(columns, lines)
+if sys.version_info >= (3, 0):
+ from tokenize import tokenize as compat_tokenize_tokenize
+else:
+ from tokenize import generate_tokens as compat_tokenize_tokenize
__all__ = [
'compat_HTTPError',
@@ -408,6 +412,7 @@ __all__ = [
'compat_socket_create_connection',
'compat_str',
'compat_subprocess_get_DEVNULL',
+ 'compat_tokenize_tokenize',
'compat_urllib_error',
'compat_urllib_parse',
'compat_urllib_parse_unquote',