fix issue with AVI not being recognised as videos (#833)

This commit is contained in:
Markos Gogoulos 2023-07-03 12:18:24 +03:00 committed by GitHub
parent 1fd04ca947
commit 4bf41fe80e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,7 +427,6 @@ class Media(models.Model):
Performs all related tasks, as check for media type, Performs all related tasks, as check for media type,
video duration, encode video duration, encode
""" """
self.set_media_type() self.set_media_type()
if self.media_type == "video": if self.media_type == "video":
self.set_thumbnail(force=True) self.set_thumbnail(force=True)
@ -477,7 +476,10 @@ class Media(models.Model):
self.duration = int(round(float(ret.get("video_duration", 0)))) self.duration = int(round(float(ret.get("video_duration", 0))))
self.video_height = int(ret.get("video_height")) self.video_height = int(ret.get("video_height"))
if ret.get("video_info", {}).get("codec_name", {}) in ["mjpeg"]: if ret.get("video_info", {}).get("codec_name", {}) in ["mjpeg"]:
audio_file_with_thumb = True # best guess that this is an audio file with a thumbnail
# in other cases, it is not (eg it can be an AVI file)
if ret.get("video_info", {}).get("avg_frame_rate", "") == '0/0':
audio_file_with_thumb = True
if ret.get("is_audio") or audio_file_with_thumb: if ret.get("is_audio") or audio_file_with_thumb:
self.media_type = "audio" self.media_type = "audio"