Эх сурвалжийг харах

add: error if no video file

micha 2 жил өмнө
parent
commit
dcca852989
1 өөрчлөгдсөн 6 нэмэгдсэн , 0 устгасан
  1. 6 0
      media/video_player.py

+ 6 - 0
media/video_player.py

@@ -2,6 +2,7 @@
 import cv2
 import pygame
 import time
+import os
 
 class Vopen():
     def __init__(self):
@@ -17,6 +18,11 @@ class Vopen():
 
     def init(self):
         print(self,"init()",self.fname)
+        if not os.path.isfile(self.fname):
+            print()
+            print("video file does not exits !! >",self.fname)
+            print()
+            exit()
         self.buffer = []
         cap = cv2.VideoCapture(self.fname)