aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-04-21 07:12:02 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-04-21 07:12:02 +0200
commit478c2c619364f5fb0c1ee9e9489048ab4ae26521 (patch)
tree65cc0f7247d9d78bffc7e95ae5d19c11eb0849ac /youtube_dl/utils.py
parentd2d6481afb064b6d809e3b131bd7365e2aeee1e1 (diff)
[clubic] Add extractor (Fixes #2773)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 116eb3610..d4df78071 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1406,3 +1406,14 @@ US_RATINGS = {
def strip_jsonp(code):
return re.sub(r'(?s)^[a-zA-Z_]+\s*\(\s*(.*)\);\s*?\s*$', r'\1', code)
+
+
+def qualities(quality_ids):
+ """ Get a numeric quality value out of a list of possible values """
+ def q(qid):
+ try:
+ return quality_ids.index(qid)
+ except ValueError:
+ return -1
+ return q
+