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
43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
# 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
|