From cc595d8fd3eed55b7ddf04182ed6360b750addab Mon Sep 17 00:00:00 2001
From: LpCote <73721863+LpCote4@users.noreply.github.com>
Date: Tue, 20 Aug 2024 14:40:56 -0400
Subject: [PATCH] added videoFileClip error management

---
 file_processor.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/file_processor.py b/file_processor.py
index b52ec4e1..8496e1c0 100644
--- a/file_processor.py
+++ b/file_processor.py
@@ -58,7 +58,13 @@ def processFiles(submission):
             if i == 0:
                 if files[i]["content_type"].find("video") != -1:
                     print("video0")
-                    clip = VideoFileClip(path)
+                    try:
+                        clip = VideoFileClip(path)
+                    except:
+                        print("ERREUR de path")
+                        submission.provided="Erreur de traitement de la soumission"
+                        db.session.commit()
+                        return
                     if clip.rotation == 90:
                         clip = clip.resize(clip.size[::-1])
                         clip.rotation = 0
@@ -119,7 +125,13 @@ def processFiles(submission):
             else:
                 if files[i]["content_type"].find("video") != -1:
                     print("video1")
-                    clip = VideoFileClip(path)
+                    try:
+                        clip = VideoFileClip(path)
+                    except:
+                        print("ERREUR de path")
+                        submission.provided="Erreur de traitement de la soumission"
+                        db.session.commit()
+                        return
                     
                     os.remove(path)
                     
-- 
GitLab