This document provides a comprehensive overview of the Video Library Manager (VLM) project, intended to be used as instructional context for Gemini.
## Project Overview
The Video Library Manager (VLM) is a Python-based CLI tool designed for managing personal video collections. It emphasizes a "safety-first" and "human-in-the-loop" approach, ensuring that no file operations are performed without explicit user confirmation and that all actions are reversible through a rollback mechanism.
***Scanning & Parsing:** Discovers video files, extracts metadata. Proactively detects `ffprobe` for video properties with graceful fallback to file-level metadata. Parses filenames for titles, years, seasons, and episodes, with specific support for Anime-style hyphenated numbering and release group stripping.
***Metadata Enrichment:** Augments local data with information from TMDB, including bilingual titles and reputation scores. It uses a local SQLite cache to improve performance.
***Analysis:** Detects duplicate files (with quality comparisons) and identifies gaps in TV series episodes.
***Planning & Execution:** Generates a reviewable JSON-based execution plan for file operations (move, rename, quarantine). Supports "safe mode" and directory preservation.
***Plan Review Cycle:** Exports high-risk operations to CSV for manual confirmation (`review-plan`) and synchronizes user decisions back to the master plan (`apply-review`), enabling a full human-in-the-loop workflow.
***Quarantine Management:** Safely isolates files for review, with full support for listing and restoration.
***Code Style:** Adheres to PEP 8, uses 4-space indentation, and includes type hints for public functions.
***Testing:** Tests are located in the `tests/` directory and written using `pytest`. The project also uses `hypothesis` for property-based testing. New features should be accompanied by tests.
***Commits:** Commit messages should be clear and descriptive.
***Documentation:** The `README.md` file is very comprehensive and should be kept up-to-date.
***Safety:** A core principle is safety. Changes to the filesystem should be gated behind user confirmation (`--confirm`) and be reversible. The tool should never permanently delete files.