How anysda/torrcast works
torrcast finds a requested film, series, or anime, selects a playable release, and streams it to a Chromecast. The principal path begins at the CLI, Telegram, or Home Assistant; search and release selection lead into playback, which manages torrent access, stream preparation, and receiver control. Supporting branches cover episode continuation, read-ahead caching, and format conversion. The source index and excerpts establish composition and some calls, while the README documents user-facing behavior; links for unsampled internals are therefore shown as unverified where needed.
Main entry points: worker.py Playback worker · wire_search.py Search and selection · packer.py HLS stream packer · main.py CLI commands
Components 20
User interfaces
- CLI commands
torrcast/cli/main.py - Telegram bot
tgbot/bot.py - Home Assistant bridge
hass/main.py
Discovery and choice
- Search and selection
torrcast/runtime/wire_search.py - Release catalogue
torrcast/adapters/prowlarr/torrent_catalogue.py - Release ranking
torrcast/usecases/rank/rank_releases.py - Title matching
torrcast/domain/alt_query.py
Playback runtime
- Playback worker
torrcast/usecases/worker.py - Episode continuation
torrcast/usecases/worker_loop.py - Torrent service
torrcast/adapters/torrserver/torr_server.py - Torrent engine port
torrcast/ports/torrent_engine.py
Stream delivery
- Chromecast receiver
torrcast/adapters/chromecast/cast/chromecast_receiver.py - HTTP HLS server
torrcast/adapters/http_server/hls_server.py - HLS stream packer
torrcast/adapters/stream_pack/packer.py - Format conversion
torrcast/adapters/recode/recoder.py
Playback support
- Read-ahead cache
torrcast/adapters/stream_pack/warm_file.py - Playback state
torrcast/adapters/filesystem/state/file_state_store.py - Film information
torrcast/adapters/wiki/wiki_articles.py
Other components
- Viewer
- Chromecast TV
Connections 23
- Viewer → CLI commands: requests playback
- Viewer → Telegram bot: sends title
- Viewer → Home Assistant bridge: starts playback
- CLI commands → Search and selection: starts selection
- Telegram bot → CLI commands: invokes commands
tgbot/bot.py - Home Assistant bridge → Search and selection: searches titles
- Search and selection → Release catalogue: queries releases
torrcast/runtime/wire_search.py - Search and selection → Release ranking: ranks choices
- Search and selection → Title matching: forms title queries
- Search and selection → Film information: loads film details
- Search and selection → Playback worker: starts playback
- Playback worker → Torrent engine port: uses torrent service
torrcast/usecases/worker.py - Torrent engine port → Torrent service: implemented by
- Playback worker → Episode continuation: runs episode loop
torrcast/usecases/worker.py - Episode continuation → Torrent engine port: adds torrent
torrcast/usecases/worker_loop.py - Playback worker → Chromecast receiver: connects receiver
- Playback worker → Playback state: loads configuration
- Playback worker → HLS stream packer: prepares stream
- HLS stream packer → Format conversion: converts when needed
- HLS stream packer → HTTP HLS server: publishes HLS
- HTTP HLS server → Chromecast TV: serves video
- Chromecast receiver → Chromecast TV: controls playback
- Playback worker → Read-ahead cache: warms media