You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
470 B
Python
15 lines
470 B
Python
2 years ago
|
def is_image_file(filename):
|
||
|
image_extensions = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".webp"]
|
||
|
# 获取文件扩展名并转换为小写
|
||
|
file_extension = filename.split(".")[-1].lower()
|
||
|
return file_extension in image_extensions
|
||
|
|
||
|
|
||
|
def is_rtsp_or_video(source):
|
||
|
if source.startswith("rtsp://"):
|
||
|
return True
|
||
|
|
||
|
video_exts = ["mp4", "avi"]
|
||
|
file_extension = source.split(".")[-1].lower()
|
||
|
return file_extension in video_exts
|