# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Build & Development Commands ```bash # Install for development pip install -e ".[dev]" # Run the application python -m tvh2jellyfin.main # Run tests pytest # Run single test pytest tests/test_file.py::test_function # Lint ruff check src/ # Format ruff format src/ ``` ## Architecture This application transfers TV recordings from a remote TVHeadend server to a local Jellyfin media library. **Data Flow:** 1. `tvheadend.py` - Queries TVHeadend JSON API for completed recordings 2. `transfer.py` - Downloads files via SCP from TVHeadend server to local destination 3. `organizer.py` - Generates destination paths organized by show name 4. `state.py` - Tracks transferred recordings (JSON file) to avoid duplicates 5. `main.py` - Orchestrates the sync loop with scheduling **Key Design Decisions:** - SCP pulls files FROM TVHeadend (source is remote, destination is local Docker volume) - TVHeadend API used for both discovery (grid_finished) and cleanup (remove after transfer) - Dry run mode skips SSH connection and all mutations - State persisted as JSON for Docker volume compatibility