# buh A media automation engine that scrapes torrent indexers, indexes torrents and their metadata, selects interesting downloads using operator-defined rules, queues downloads, processes downloaded files using renaming rules, and syncs renamed files to configured LAN targets. The end goal is to populate a Jellyfin (or similar) media server with content — shows, movies, music, books, and audio-books — based on ingestion rules, and to later discard content based on operator discard rules. ## Architecture ``` buh-entity pure data structs (serde only, no logic) ↑ buh-data data access layer (Turso/libsql) ↑ buh-util domain logic (scraper, rules, processor, sync) ↑ buh-cli CLI binary ("buh") buh-ws WebSocket server (axum) ``` All crates live under `crates/` in a single Cargo workspace. ## Usage ### CLI ```bash # interactive client mode (default) buh # run daemon routines from config buh daemon --config /etc/buh/daemon.toml ``` The `client` subcommand is assumed when no subcommand is provided. ### WebSocket server ```bash cargo run -p buh-ws # listens on 0.0.0.0:9000, endpoint /ws ``` ## Configuration The daemon reads a TOML configuration file. See [`daemon.toml`](daemon.toml) for an example. ```toml [database] url = "libsql://your-db.turso.io" auth_token = "your-token" [[indexers]] name = "example-indexer" url = "https://example.com/api" media_types = ["show", "movie"] [[sync]] name = "jellyfin-shows" media_type = "show" path = "/mnt/media/shows" [routines] scrape = true process = true sync = true ``` ## Building ```bash cargo build --workspace cargo test --workspace ``` Requires Rust edition 2024 (stable 1.85+). ## License MIT