A Docker-based Python application that transfers completed recordings from TVHeadend to Jellyfin media storage via SCP. Features: - Monitors TVHeadend for completed recordings via JSON API - Transfers files via SCP with SSH key authentication - Organizes files by show name - Deletes recordings from TVHeadend after successful transfer - Tracks transferred files to avoid duplicates - Dry run mode for testing without making changes
1.2 KiB
1.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build & Development Commands
# 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:
tvheadend.py- Queries TVHeadend JSON API for completed recordingstransfer.py- Downloads files via SCP from TVHeadend server to local destinationorganizer.py- Generates destination paths organized by show namestate.py- Tracks transferred recordings (JSON file) to avoid duplicatesmain.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