content_type based on vcodec/acodec
This commit is contained in:
parent
7d333487fe
commit
bf7a0fcec0
|
@ -1142,7 +1142,18 @@ class Media(models.Model):
|
||||||
return 'video/mp4'
|
return 'video/mp4'
|
||||||
vcodec = self.downloaded_video_codec
|
vcodec = self.downloaded_video_codec
|
||||||
if vcodec is None:
|
if vcodec is None:
|
||||||
return 'audio/ogg'
|
acodec = self.downloaded_audio_codec
|
||||||
|
if acodec is None:
|
||||||
|
raise TypeError() # nothing here.
|
||||||
|
|
||||||
|
acodec = acodec.lower()
|
||||||
|
if acodec == "mp4a":
|
||||||
|
return "audio/mp4"
|
||||||
|
elif acodec == "opus":
|
||||||
|
return "audio/opus"
|
||||||
|
else:
|
||||||
|
# fall-fall-back.
|
||||||
|
return 'audio/ogg'
|
||||||
|
|
||||||
vcodec = vcodec.lower()
|
vcodec = vcodec.lower()
|
||||||
if vcodec == 'vp9':
|
if vcodec == 'vp9':
|
||||||
|
|
Loading…
Reference in New Issue