content_type based on vcodec/acodec

This commit is contained in:
KuhnChris 2023-02-12 13:22:57 +01:00
parent 7d333487fe
commit bf7a0fcec0
1 changed files with 12 additions and 1 deletions

View File

@ -1142,6 +1142,17 @@ class Media(models.Model):
return 'video/mp4'
vcodec = self.downloaded_video_codec
if vcodec is None:
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()