From f4d96df0f1e978d580197fafb8dacade4b611ef3 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 18 Oct 2013 00:46:35 +0200 Subject: Extend #980 with --max-quality support --- youtube_dl/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'youtube_dl/utils.py') diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 833f981..bfb8f6b 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -947,6 +947,15 @@ def shell_quote(args): return ' '.join(map(pipes.quote, args)) +def takewhile_inclusive(pred, seq): + """ Like itertools.takewhile, but include the latest evaluated element + (the first element so that Not pred(e)) """ + for e in seq: + yield e + if not pred(e): + return + + def smuggle_url(url, data): """ Pass additional data in a URL for internal use. """ -- cgit v1.1