File size: 274 Bytes
1425afc
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os

ALLOWED = [".mp4", ".mov", ".mkv"]


def validate_video(path):

    if not os.path.exists(path):
        raise Exception("File not found")

    ext = os.path.splitext(path)[1].lower()

    if ext not in ALLOWED:
        raise Exception("Unsupported video format")