Skip to content
gorkamoleroPublic

About

Cyberpunk TUI for streaming to Chromecast

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

StreamTUI

╔═══════════════════════════════════════════════════════════════╗
β•‘  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•‘
β•‘  β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β•‘
β•‘  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•‘
β•‘  β•šβ•β•β•β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•‘
β•‘  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ•β• β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•‘
β•‘  β•šβ•β•β•β•β•β•β•   β•šβ•β•   β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•     β•šβ•β•   β•šβ•β•   β•‘
β•‘                        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—                   β•‘
β•‘                        β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘                   β•‘
β•‘                           β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘                   β•‘
β•‘                           β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘                   β•‘
β•‘                           β–ˆβ–ˆβ•‘   β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘                   β•‘
β•‘                           β•šβ•β•    β•šβ•β•β•β•β•β• β•šβ•β•                   β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

A neon-soaked terminal interface for streaming to Chromecast

License: MIT Rust


Overview

StreamTUI is a cyberpunk-themed Terminal User Interface for searching movies and TV shows, selecting stream quality, and casting to your Chromecast β€” all from the comfort of your terminal.

Built with performance in mind: zero cold start (instant launch), full keyboard navigation, and complete CLI automation for scripting and AI agent integration.

✨ Features

Interactive TUI

  • 🎨 Cyberpunk neon theme with WCAG-compliant contrast ratios
  • ⌨️ Vim-style navigation (j/k, /, Esc)
  • πŸ” Real-time search with trending content
  • πŸ“Ί Multi-quality streams (4K, 1080p, 720p, 480p)
  • 🌐 Subtitle support with language selection and trust indicators
  • πŸ“Š Live playback status with progress bar

CLI Automation

  • πŸ€– JSON output for scripting and automation
  • πŸ”§ Semantic exit codes for error handling
  • ⚑ Single-command casting for quick access
  • 🎯 Claude Code / AI agent friendly β€” designed for LLM integration

Playback Control

  • ▢️ Play / ⏸️ Pause / ⏹️ Stop
  • ⏩ Seek (absolute, relative, timestamp)
  • πŸ”Š Volume control
  • πŸ“± Device discovery and selection

πŸ“¦ Installation

From Source (Recommended)

# Clone the repository
git clone https://github.com/your-username/streamtui.git
cd streamtui

# Build and install
cargo install --path .

Dependencies

StreamTUI requires these external tools for full functionality:

# webtorrent-cli - Torrent streaming
npm install -g webtorrent-cli

# catt - Chromecast control
pip install catt

Verify Installation

# Check webtorrent
webtorrent --version

# Check catt  
catt --version

# Check streamtui
streamtui --help

πŸš€ Usage

TUI Mode (Interactive)

Simply run without arguments to launch the interactive interface:

streamtui

Keyboard Shortcuts

Key Action
/ Start search
↑/↓ or j/k Navigate lists
Page Up/Down Navigate by page
Home/End Jump to first/last
Enter Select item
c View sources (from detail view)
u Select subtitles
Space Play/Pause
←/β†’ Seek Β±10s
Esc Go back
q Quit

CLI Mode (Automation)

Every TUI action is available as a CLI command with JSON output. Commands support short aliases for faster typing.

Command Reference

Command Alias Description
search s Search for movies and TV shows
trending tr Get trending content
info i Get details for a movie or show
streams st Get available streams for content
subtitles sub Search for subtitles
devices dev List available Chromecast devices
cast β€” Start casting content to a device
cast-magnet cm Cast a raw magnet link directly
play-local pl Play locally in VLC or mpv
status β€” Get current playback status
play β€” Resume playback
pause β€” Pause playback
stop β€” Stop playback and disconnect
seek β€” Seek to a position
volume vol Set volume level

Search Content

# Basic search
streamtui search "blade runner"
streamtui s "blade runner"  # alias

# Filter by type
streamtui search "breaking bad" --media-type tv

# Limit results and filter by year
streamtui search "batman" --limit 5 --year-from 2020

# JSON output (automatic when piped)
streamtui search "inception" --json

Options:

  • --limit, -l <N> β€” Maximum results (default: 20)
  • --media-type, -t <movie|tv> β€” Filter by type
  • --year-from <YYYY> β€” Minimum year
  • --year-to <YYYY> β€” Maximum year

Browse Trending

# Today's trending
streamtui trending
streamtui tr  # alias

# This week's trending movies
streamtui trending --window week --media-type movie

Options:

  • --window, -w <day|week> β€” Time window (default: day)
  • --limit, -l <N> β€” Maximum results (default: 20)
  • --media-type, -t <movie|tv> β€” Filter by type

Get Content Info

# Get movie/show details
streamtui info tt1877830
streamtui i tt1877830  # alias

Get Streams

# Movie streams
streamtui streams tt1856101
streamtui st tt1856101  # alias

# TV episode streams  
streamtui streams tt0903747 --season 1 --episode 1

# Filter by quality and sort by seeds
streamtui streams tt1877830 --quality 1080p --sort seeds

Options:

  • --season, -s <N> β€” Season number (TV only)
  • --episode, -e <N> β€” Episode number (TV only)
  • --quality, -Q <4k|1080p|720p|480p> β€” Filter by minimum quality
  • --limit, -l <N> β€” Maximum results (default: 20)
  • --sort <seeds|quality|size> β€” Sort criterion (default: seeds)

Find Subtitles

# English subtitles
streamtui subtitles tt1856101 --lang en
streamtui sub tt1856101 -l en  # alias

# Multiple languages
streamtui subtitles tt0903747 --lang "en,es,fr" -s 1 -e 1

# Only trusted/verified subtitles
streamtui subtitles tt1877830 --trusted

Options:

  • --lang, -l <codes> β€” Comma-separated language codes (default: en)
  • --season, -s <N> β€” Season number (TV only)
  • --episode, -e <N> β€” Episode number (TV only)
  • --hearing-impaired β€” Only show hearing-impaired subtitles
  • --trusted β€” Only show trusted/verified subtitles
  • --limit <N> β€” Maximum results (default: 20)

Discover Devices

# List available Chromecasts
streamtui devices
streamtui dev  # alias

# Extended scan with longer timeout
streamtui devices --timeout 10

# Force refresh device cache
streamtui devices --refresh

Options:

  • --timeout, -t <secs> β€” Scan timeout (default: 5)
  • --refresh, -r β€” Refresh device cache

Cast Content

# Cast movie to device
streamtui cast tt1856101 --device "Living Room TV"

# Cast with quality preference
streamtui cast tt1877830 -d "Bedroom TV" -Q 1080p

# Cast TV episode with subtitles
streamtui cast tt0903747 -s 1 -e 1 -d TV --subtitle en

# Cast specific stream index
streamtui cast tt1877830 -d TV --index 0

# Play locally in VLC instead of casting
streamtui cast tt1877830 --vlc

Options:

  • --device, -d <name> β€” Target device (required unless default set)
  • --quality, -Q <4k|1080p|720p|480p> β€” Preferred quality
  • --season, -s <N> β€” Season number (TV only)
  • --episode, -e <N> β€” Episode number (TV only)
  • --index, -i <N> β€” Stream index from streams output
  • --subtitle <lang> β€” Subtitle language code
  • --subtitle-id <id> β€” Specific subtitle ID from subtitles output
  • --no-subtitle β€” Explicitly disable subtitles
  • --start <secs> β€” Start position in seconds
  • --vlc β€” Play locally in VLC instead of casting

Cast Magnet Link Directly

# Cast a magnet link
streamtui cast-magnet "magnet:?xt=urn:btih:..." --device TV
streamtui cm "magnet:?xt=..." -d TV  # alias

# With subtitles
streamtui cast-magnet "magnet:?xt=..." -d TV --subtitle en

# With local subtitle file
streamtui cast-magnet "magnet:?xt=..." -d TV --subtitle-file /path/to/subs.srt

Options:

  • --device, -d <name> β€” Target device
  • --subtitle <lang> β€” Search for subtitles in this language (via Stremio)
  • --subtitle-file <path> β€” Path to local subtitle file (.srt, .vtt)
  • --file-idx, -i <N> β€” File index within torrent (default: largest video)
  • --start <secs> β€” Start position
  • --vlc β€” Play locally in VLC instead

Play Locally (No Chromecast)

# Play magnet in VLC
streamtui play-local "magnet:?xt=..."
streamtui pl "magnet:?xt=..."  # alias

# Play in mpv instead
streamtui play-local "magnet:?xt=..." --player mpv

# With subtitles
streamtui play-local "magnet:?xt=..." --subtitle-file /path/to/subs.srt

Options:

  • --player, -p <vlc|mpv> β€” Player to use (default: vlc)
  • --subtitle-file <path> β€” Path to local subtitle file
  • --file-idx, -i <N> β€” File index within torrent

Playback Control

# Check status
streamtui status
streamtui status --json  # For scripting

# Watch mode - continuously update
streamtui status --watch --interval 2

# Play/Pause
streamtui play
streamtui pause

# Seek - multiple formats supported
streamtui seek 3600      # To 1 hour (absolute seconds)
streamtui seek +30       # Forward 30 seconds
streamtui seek -10       # Back 10 seconds
streamtui seek 1:30:00   # To timestamp (HH:MM:SS)
streamtui seek 5:30      # To timestamp (MM:SS)

# Volume
streamtui volume 50      # Set to 50%
streamtui vol +10        # Increase by 10%
streamtui vol -5         # Decrease by 5%

# Stop
streamtui stop
streamtui stop --kill-stream  # Also stop torrent

Global Options

These flags work with any command:

--json, -j        # Force JSON output (default for non-TTY)
--device, -d      # Set default Chromecast device
--quiet, -q       # Suppress non-essential output
--config, -c      # Custom config file path

πŸ€– Claude Code / AI Agent Integration

StreamTUI is designed for seamless AI agent integration. Every action is scriptable with JSON output and semantic exit codes.

Search and Cast Workflow

# Agent searches for content
result=$(streamtui search "the matrix" --json | jq -r '.data[0].imdb_id')

# Agent gets available streams
streamtui streams "$result" --json | jq '.data[] | {quality, seeds, title}'

# Agent casts best quality
streamtui cast "$result" --device "TV" --quality 1080p --json

Status Monitoring

# Check if something is playing
state=$(streamtui status --json | jq -r '.data.state')
if [ "$state" = "playing" ]; then
    echo "Currently playing!"
fi

# Get playback progress
streamtui status --json | jq '{title: .data.title, progress: (.data.progress * 100 | floor | tostring + "%")}'

Automated Evening Routine

#!/bin/bash
# Find a trending movie and cast it

movie=$(streamtui trending --media-type movie --json | jq -r '.data[0].imdb_id')
streamtui cast "$movie" --device "Living Room TV" --quality 1080p

Direct Magnet Casting

# Agent has a magnet link from external source
streamtui cast-magnet "$MAGNET_LINK" -d "TV" --subtitle en

Error Handling Pattern

#!/bin/bash
# Robust casting with error handling

imdb_id="tt1877830"
device="Living Room TV"

# Try to cast
if streamtui cast "$imdb_id" -d "$device" -Q 1080p --json 2>/dev/null; then
    echo "Casting started successfully"
else
    exit_code=$?
    case $exit_code in
        4) echo "Device '$device' not found" ;;
        5) echo "No streams available for $imdb_id" ;;
        6) echo "Cast failed" ;;
        *) echo "Unknown error: $exit_code" ;;
    esac
    exit $exit_code
fi

Exit Codes

For robust scripting, StreamTUI uses semantic exit codes:

Code Meaning
0 Success
1 General error
2 Invalid arguments
3 Network error
4 Device not found
5 No streams available
6 Cast failed

JSON Output Format

All commands output consistent JSON when --json is used or when stdout is not a TTY:

// Success
{
  "data": { ... },
  "exit_code": 0
}

// Error
{
  "error": "Error message",
  "exit_code": 4
}

βš™οΈ Configuration

StreamTUI looks for configuration at ~/.config/streamtui/config.toml:

# Default Chromecast device
default_device = "Living Room TV"

# Preferred quality (4k, 1080p, 720p, 480p)
preferred_quality = "1080p"

# Preferred subtitle languages (first match wins)
subtitle_languages = ["en", "es"]

# API keys (optional - uses defaults)
# tmdb_api_key = "your-key"

πŸ“Έ Screenshots

Manual screenshots coming soon...

TUI Interface (ASCII Preview)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STREAMTUI β”‚ βŒ• blade runner                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ⚑ RESULTS (5)                                              β”‚
β”‚                                                             β”‚
β”‚ β–Έ Blade Runner 2049 (2017) [MOVIE] β˜… 7.5                   β”‚
β”‚   Blade Runner (1982) [MOVIE] β˜… 8.1                        β”‚
β”‚   Blade Runner: Black Lotus (2021) [TV] β˜… 6.4              β”‚
β”‚   Blade Runner: Black Out 2022 (2017) [MOVIE] β˜… 7.4        β”‚
β”‚   Making of Blade Runner (2007) [MOVIE] β˜… 7.8              β”‚
β”‚                                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ NORMAL β”‚ SEARCH β”‚ πŸ“Ί Living Room TV β”‚ q:quit /:search ESC:back β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Now Playing Overlay

╔═══════════════════════════════════════════════════════════╗
β•‘  β–Ά NOW CASTING                                            β•‘
β•‘                                                           β•‘
β•‘  Blade Runner 2049 (2017)                                 β•‘
β•‘  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  1:23:45 / 2:43:00       β•‘
β•‘                                                           β•‘
β•‘  πŸ“Ί Living Room TV  β”‚  πŸ”Š 75%  β”‚  🎬 1080p               β•‘
β•‘  [Space] Pause  [s] Stop  [←/β†’] Seek  [Esc] Hide         β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Quality Selection

β”Œβ”€ SELECT STREAM ─────────────────────────────────────────────┐
β”‚                                                             β”‚
β”‚ β–Έ [1] 2160p WEB-DL HDR       12.1 GB   Seeds: 89    β˜…β˜…β˜…β˜…  β”‚
β”‚   [2] 1080p BluRay x264       4.2 GB   Seeds: 142   β˜…β˜…β˜…   β”‚
β”‚   [3] 1080p WEB-DL            2.8 GB   Seeds: 234   β˜…β˜…β˜…   β”‚
β”‚   [4] 720p WEB                1.8 GB   Seeds: 567   β˜…β˜…    β”‚
β”‚   [5] 480p WEB                 890 MB  Seeds: 123   β˜…     β”‚
β”‚                                                             β”‚
β”‚ [Enter] Cast  [c] Cast to device  [Esc] Back               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Development

# Run in development
cargo run

# Run tests (654 tests)
cargo test

# Run specific test module
cargo test --test tmdb_test

# Lint
cargo clippy

# Format
cargo fmt

# Build release binary
cargo build --release

Project Structure

streamtui/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs          # Entry point, TUI loop
β”‚   β”œβ”€β”€ app.rs           # Application state machine
β”‚   β”œβ”€β”€ cli.rs           # CLI argument parsing
β”‚   β”œβ”€β”€ commands.rs      # CLI command handlers
β”‚   β”œβ”€β”€ models.rs        # Data structures
β”‚   β”œβ”€β”€ api/             # API clients
β”‚   β”‚   β”œβ”€β”€ tmdb.rs      # TMDB for search/info
β”‚   β”‚   └── torrentio.rs # Torrentio for streams
β”‚   β”œβ”€β”€ stream/          # Streaming components
β”‚   β”‚   β”œβ”€β”€ torrent.rs   # webtorrent-cli wrapper
β”‚   β”‚   β”œβ”€β”€ cast.rs      # catt wrapper
β”‚   β”‚   └── subtitles.rs # Stremio subtitle client
β”‚   └── ui/              # TUI components
β”‚       β”œβ”€β”€ theme.rs     # Cyberpunk color palette
β”‚       β”œβ”€β”€ search.rs    # Search view
β”‚       β”œβ”€β”€ browser.rs   # Content browser
β”‚       β”œβ”€β”€ detail.rs    # Detail view
β”‚       β”œβ”€β”€ subtitles.rs # Subtitle selection
β”‚       └── player.rs    # Now playing overlay
β”œβ”€β”€ tests/               # Integration tests
└── specs/               # Design specifications

πŸ“„ License

MIT License - see LICENSE for details.


Built with πŸ’œ by Gorka & Hermes

"The future is now, old man."

About

Cyberpunk TUI for streaming to Chromecast

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages