aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-01-27 21:11:17 +0600
committerSergey M․ <dstftw@gmail.com>2016-01-27 21:11:17 +0600
commitb0d21deda95e7e49e162c12aa305f27e477e0ce9 (patch)
treeb051e203d9e4a1b83f6a4a84459ad8381e672ee2 /youtube_dl/extractor/common.py
parentfab6f0e65b0084ce8b29c0810b874d132ffcd47c (diff)
[extractor/common] Auto calculate tbr when missing
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 2f574054d..f5a358388 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -825,6 +825,12 @@ class InfoExtractor(object):
if not formats:
raise ExtractorError('No video formats found')
+ for f in formats:
+ # Automatically determine tbr when missing based on abr and vbr (improves
+ # formats sorting in some cases)
+ if 'tbr' not in f and 'abr' in f and 'vbr' in f:
+ f['tbr'] = f['abr'] + f['vbr']
+
def _formats_key(f):
# TODO remove the following workaround
from ..utils import determine_ext