Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue with AVI not being recognised as videos #833

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions files/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ def media_init(self):
Performs all related tasks, as check for media type,
video duration, encode
"""

self.set_media_type()
if self.media_type == "video":
self.set_thumbnail(force=True)
Expand Down Expand Up @@ -477,7 +476,10 @@ def set_media_type(self, save=True):
self.duration = int(round(float(ret.get("video_duration", 0))))
self.video_height = int(ret.get("video_height"))
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:
self.media_type = "audio"
Expand Down