projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
845817a
)
[utils] Add codec2ext
author
Yen Chi Hsuan
<yan12125@gmail.com>
Sat, 5 Mar 2016 10:18:28 +0000
(18:18 +0800)
committer
Yen Chi Hsuan
<yan12125@gmail.com>
Sat, 5 Mar 2016 10:18:28 +0000
(18:18 +0800)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 22a39a0ab7af191095242e6b2a3f580e59e17c37..dc0bf5627a5d149da4790b1f2d938649ed7924f9 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1893,6
+1893,19
@@
def mimetype2ext(mt):
}.get(res, res)
+def codec2ext(codec):
+ codec_type = codec.split('.')[0]
+
+ # Leave the return value None for unknown values as codec_type
+ # is not a good fallback for file extensions
+ return {
+ 'avc1': 'mp4',
+ 'mp4a': 'm4a',
+ 'vorbis': 'webm',
+ 'vp9': 'webm',
+ }.get(codec_type)
+
+
def urlhandle_detect_ext(url_handle):
try:
url_handle.headers