2.7 KiB
2.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
MovieTagger is a PySide6/Qt desktop application for managing and tagging movie video files. It parses filenames, queries the TMDB API for metadata, and renames files to a standardized format.
Commands
# Install dependencies (including dev tools)
pip install -e ".[dev]"
# Run in development
python -m movietagger
# or
python main.py
# Build standalone executable (PyInstaller)
pyinstaller MovieTagger.spec
Required environment variables (set in ~/.config/MovieTagger/config.ini or shell):
TMDB_KEY— TMDB API keyTMDB_LANGUAGE— e.g.en-USTMDB_REGION— e.g.US
There are no tests or linting configurations.
Architecture
Layer Structure
core/ — Pure business logic (no Qt imports)
services/ — External API clients
qt/ — All UI and threading (Qt-dependent)
qt/workers/ — Background QThread workers
Data Flow
- Load:
LoadWorkerscans directories, callsnaming.parse_video_stem()to extractMovieRowobjects (title, year, tags, existing TMDB/IMDB IDs). - Display:
MovieTableModel+MovieProxyModelhold and filter theMovieRowlist in the main table view. - Search:
TmdbSearchWorker(orBatchScanWorkerfor bulk) callsTmdbService, returnsMoviePickobjects. The user selects a pick viaMoviePickDialog, which updates the row's IDs. - Save:
SaveWorkercallsnaming.build_video_stem()on each row to construct the new filename, then renames files on disk.
Key Design Patterns
- Threading: Workers are
QObjectsubclasses moved toQThread. Communication is strictly via Qt signals/slots. Cancellation usesthreading.Event. - Proxy model:
MovieProxyModelwrapsMovieTableModel— handles both filtering (hide already-matched rows) and token-based title search without modifying the source model. - Config:
core/config.pyreads/writes~/.config/MovieTagger/config.iniviaplatformdirs. Settings schema is defined as aSETTINGSlist ofSettingKind-typed dicts inconfig.py. - Rate limiting:
RateLimiterincore/ratelimiter.pythrottles TMDB API calls across concurrent workers.
Filename Format
Parsed and generated by core/naming.py:
Title (YEAR) [tag1] [tag2] {edition-X} {tmdb-12345}.mkv
- Tags are freeform bracketed tokens (e.g.
[Directors Cut],[2160p]) - Edition is
{edition-...} - Provider IDs are
{tmdb-...}or{imdb-...}
IMDB Service
services/imdb_service.py and qt/workers/imdb_search_worker.py are stubs — they exist in the UI but return no results.