=============== LIBRARY RULES =============== From library maintainers: - Import from video_extensions: is_video_extension, is_video_path, VIDEO_EXTENSIONS, VIDEO_EXTENSIONS_LOWER. ### Install video-extensions with pip Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Install the package using pip. ```bash pip install video-extensions ``` -------------------------------- ### Install video-extensions with uv Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Alternative installation using the uv package manager. ```bash uv add video-extensions ``` -------------------------------- ### Check if an extension is a video type with is_video_extension Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Use is_video_extension to determine whether a given file extension is recognized as a video type. The function accepts extensions with or without a leading dot, as shown by the examples returning True for 'mp4' and False for '.txt'. ```python from video_extensions import is_video_extension is_video_extension("mp4") # True is_video_extension(".txt") # False ``` -------------------------------- ### Check if a file path has a video extension with is_video_path Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Use is_video_path to check whether a file path ends with a recognized video extension. The function handles both relative and absolute paths and is case-insensitive, as shown by the example returning True for '/path/to/video.MOV'. ```python from video_extensions import is_video_path is_video_path("movie.mp4") # True is_video_path("document.txt") # False is_video_path("/path/to/video.MOV") # True ``` -------------------------------- ### Access the list of video extensions Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Access the frozenset VIDEO_EXTENSIONS and its lowercase version VIDEO_EXTENSIONS_LOWER for membership checks and iteration. ```python from video_extensions import VIDEO_EXTENSIONS, VIDEO_EXTENSIONS_LOWER # VIDEO_EXTENSIONS is a frozenset of all known video extensions print(len(VIDEO_EXTENSIONS)) # 34 "mp4" in VIDEO_EXTENSIONS # True "txt" in VIDEO_EXTENSIONS # False # VIDEO_EXTENSIONS_LOWER contains all extensions in lowercase # Useful for case-insensitive lookups without calling .lower() repeatedly "MP4" in VIDEO_EXTENSIONS_LOWER # True (case-insensitive) # Iterate over all extensions for ext in sorted(VIDEO_EXTENSIONS): print(ext) ``` -------------------------------- ### is_video_extension(ext: str) -> bool Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Returns True if the given file extension is known to be a video type. Accepts extensions with or without a leading dot. ```APIDOC ## is_video_extension(ext: str) -> bool ### Description Returns True if the given file extension is known to be a video type. ### Parameters - **ext** (str) - Required - The file extension to check. ### Returns - **bool** - True if the extension is a video extension, False otherwise. ### Request Example ```python from video_extensions import is_video_extension is_video_extension("mp4") # True is_video_extension(".txt") # False ``` ``` -------------------------------- ### Check if a file path has a video extension Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Use is_video_path to check if a file path ends with a known video extension. Supports case-insensitive and dotfile paths. ```python from video_extensions import is_video_path is_video_path("movie.mp4") # True is_video_path("/path/to/video.MOV") # True (case-insensitive) is_video_path("presentation.avi") # True is_video_path("document.txt") # False is_video_path(".mov") # True (dotfile support) ``` -------------------------------- ### Check if an extension is a video type Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Use is_video_extension to check if a file extension is a known video type. Supports dot-aware and case-insensitive checks. ```python from video_extensions import is_video_extension is_video_extension("mp4") # True is_video_extension(".mov") # True (dot-aware) is_video_extension("AVI") # True (case-insensitive) is_video_extension("txt") # False ``` -------------------------------- ### is_video_path(file_path: str) -> bool Source: https://github.com/ysskrishna/video-extensions/blob/main/README.md Returns True if the given file path has a video file extension. The check is case-insensitive. ```APIDOC ## is_video_path(file_path: str) -> bool ### Description Returns True if the file path has a video file extension. ### Parameters - **file_path** (str) - Required - The file path to check. ### Returns - **bool** - True if the file path has a video extension, False otherwise. ### Request Example ```python from video_extensions import is_video_path is_video_path("movie.mp4") # True is_video_path("document.txt") # False is_video_path("/path/to/video.MOV") # True ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.