Clean up format_note() a bit

I want to do a lot more on this later for readability.
This commit is contained in:
AGSPhoenix 2014-03-06 20:28:14 -05:00
parent 3984bcded8
commit 490919d461

View File

@ -1105,39 +1105,29 @@ class YoutubeDL(object):
if fdict.get('tbr') is not None: if fdict.get('tbr') is not None:
res += '%4dk ' % fdict['tbr'] res += '%4dk ' % fdict['tbr']
if fdict.get('container') is not None: if fdict.get('container') is not None:
if res: res += ', %s container' % fdict['container']
res += ', '
res += '%s container' % fdict['container']
if (fdict.get('vcodec') is not None and if (fdict.get('vcodec') is not None and
fdict.get('vcodec') != 'none'): fdict.get('vcodec') != 'none'):
if res: res += ', ' + fdict['vcodec']
res += ', '
res += fdict['vcodec']
if fdict.get('vbr') is not None: if fdict.get('vbr') is not None:
res += '@' res += '@'
elif fdict.get('vbr') is not None and fdict.get('abr') is not None: elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
res += 'video@' res += ', video@'
if fdict.get('vbr') is not None: if fdict.get('vbr') is not None:
res += '%4dk' % fdict['vbr'] res += '%4dk' % fdict['vbr']
if fdict.get('acodec') is not None: if fdict.get('acodec') is not None:
if res:
res += ', '
if fdict['acodec'] == 'none': if fdict['acodec'] == 'none':
res += 'video only' res += ', video only'
else: else:
res += '%-5s' % fdict['acodec'] res += ', %-5s' % fdict['acodec']
elif fdict.get('abr') is not None: elif fdict.get('abr') is not None:
if res: res += ', audio'
res += ', '
res += 'audio'
if fdict.get('abr') is not None: if fdict.get('abr') is not None:
res += '@%3dk' % fdict['abr'] res += '@%3dk' % fdict['abr']
if fdict.get('asr') is not None: if fdict.get('asr') is not None:
res += ' (%5dHz)' % fdict['asr'] res += ' (%5dHz)' % fdict['asr']
if fdict.get('filesize') is not None: if fdict.get('filesize') is not None:
if res: res += ', ' + format_bytes(fdict['filesize'])
res += ', '
res += format_bytes(fdict['filesize'])
return res return res
def line(format, idlen=20): def line(format, idlen=20):