1
0
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-18 07:26:41 +00:00

[extractor/common] Auto calculate tbr when missing

This commit is contained in:
Sergey M․ 2016-01-27 21:11:17 +06:00
parent fab6f0e65b
commit b0d21deda9

View File

@ -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