aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-11-16 01:08:43 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-11-16 01:08:43 +0100
commit91c7271aabdd74c833ef570db59018e2d9f9d803 (patch)
treef34460e0735ce84e65ba6f4fe53355bebe1aaf16 /youtube_dl/YoutubeDL.py
parentaa13b2dffde73978fe2a169d3f99de7e5e7754cb (diff)
Add automatic generation of format note based on bitrate and codecs
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index b5c670dd4..9c79af1f2 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -781,12 +781,28 @@ class YoutubeDL(object):
return res
def list_formats(self, info_dict):
+ def format_note(fdict):
+ if fdict.get('format_note') is not None:
+ return fdict['format_note']
+ res = u''
+ if fdict.get('vcodec') is not None:
+ res += fdict['vcodec']
+ if fdict.get('vbr') is not None:
+ res += u'@%4dk' % fdict['vbr']
+ if fdict.get('acodec') is not None:
+ if res:
+ res += u', '
+ res += fdict['acodec']
+ if fdict.get('abr') is not None:
+ res += u'@%3dk' % fdict['abr']
+ return res
+
def line(format):
return (u'%-20s%-10s%-12s%s' % (
format['format_id'],
format['ext'],
self.format_resolution(format),
- format.get('format_note', ''),
+ format_note(format),
)
)