TorrentClaw CLI agent: torrent + Usenet downloader, debrid integration
Find a file
Deivid Soto a73e1a7756 feat(agent): add mirror failover, agent client refactor, status 401 detection
- Mirror pool with health tracking and exponential backoff for failed hosts
- Agent client routes requests through mirror pool with retry semantics
- New `unarr mirrors` command to inspect mirror state and force failover
- `unarr status` now detects 401 from /agent/register and suggests `unarr login`
  instead of the generic "Could not fetch account info" message
- Config supports multiple ScanPaths for upcoming multi-path library scan
- Draft plan for bidirectional library sync (CLI ↔ Web) under Docs/plans/
2026-05-15 16:26:43 +02:00
.github test(coverage): raise engine+agent coverage above 50% 2026-05-12 11:21:59 +02:00
.lefthook/commit-msg feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
cmd feat(wstracker-probe): -seed FILE mode for browser ↔ unarr e2e validation 2026-05-06 14:46:38 +02:00
Docs/plans feat(agent): add mirror failover, agent client refactor, status 401 detection 2026-05-15 16:26:43 +02:00
internal feat(agent): add mirror failover, agent client refactor, status 401 detection 2026-05-15 16:26:43 +02:00
scripts feat(release): bundle ffmpeg + ffprobe in tarballs and Docker image 2026-05-06 11:26:01 +02:00
.dockerignore feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
.gitignore chore(gitignore): add dist-ffbinaries to ignored files 2026-05-08 11:29:54 +02:00
.golangci.yml fix(lint): use default:none to disable errcheck, fix all gofmt and exhaustive 2026-03-31 00:29:16 +02:00
.goreleaser.yml feat(release): bundle ffmpeg + ffprobe in tarballs and Docker image 2026-05-06 11:26:01 +02:00
CHANGELOG.md chore(release): 0.8.1 2026-05-08 17:23:19 +02:00
cliff.toml chore(release): add changelog generation and release automation 2026-04-06 10:16:01 +02:00
CODE_OF_CONDUCT.md feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
CONTRIBUTING.md chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
docker-build.sh chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
docker-compose.yml chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
Dockerfile feat(release): bundle ffmpeg + ffprobe in tarballs and Docker image 2026-05-06 11:26:01 +02:00
DOCKERHUB.md chore(deps): bump Alpine 3.21→3.22, update CI actions and linter 2026-03-31 11:39:45 +02:00
go.mod feat(stream): pion-based WebRTC byte streamer for browser playback 2026-05-06 23:12:38 +02:00
go.sum feat(stream): add NAT-PMP port mapping for remote downloads 2026-04-06 10:09:07 +02:00
install.ps1 chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
install.sh chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
lefthook.yml test: add comprehensive test suite for engine, agent and cmd packages 2026-04-08 23:36:00 +02:00
LICENSE feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
Makefile chore(release): add changelog generation and release automation 2026-04-06 10:16:01 +02:00
README.md feat(config): set default values for WebRTC and transcoding in minimal TOML config 2026-05-08 17:21:53 +02:00
SECURITY.md chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00

unarr

⚠️ Beta — unarr is under active development. Features may change, and bugs are expected. Report issues here.

CI Latest Release Go Report Card Coverage VirusTotal Docker Pulls License: MIT Go Version

Powerful terminal tool for torrent search and management. Free and open source.

Search 30+ torrent sources, inspect torrent quality, discover popular content, find streaming providers, and manage your media collection — all from your terminal.

Installation

Quick install (Linux/macOS)

curl -fsSL https://get.torrentclaw.com/install.sh | sh

PowerShell (Windows)

irm https://get.torrentclaw.com/install.ps1 | iex

Homebrew (macOS/Linux)

brew install torrentclaw/tap/unarr

Docker

docker run -d --name unarr \
  --restart unless-stopped \
  --network host \
  --read-only --memory 512m \
  -v ~/.config/torrentclaw:/config \
  -v ~/Media:/downloads \
  torrentclaw/unarr

Run setup first to configure your API key:

docker run -it --rm \
  -v ~/.config/torrentclaw:/config \
  torrentclaw/unarr setup

Docker Compose

mkdir -p torrentclaw && cd torrentclaw
curl -fsSL https://raw.githubusercontent.com/torrentclaw/unarr/main/docker-compose.yml -o docker-compose.yml
docker compose up -d
docker-compose.yml
services:
  unarr:
    image: torrentclaw/unarr:latest
    container_name: unarr
    restart: unless-stopped
    user: "1000:1000"
    read_only: true
    tmpfs:
      - /tmp:size=64m,mode=1777
    volumes:
      - ./config:/config
      - ~/Media:/downloads
      - unarr-data:/data
    environment:
      - TZ=${TZ:-UTC}
      # - UNARR_API_KEY=tc_your_key_here
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: "2.0"
    # Host network for full P2P performance
    network_mode: host
    # Or use bridge with ports:
    # ports:
    #   - "6881-6889:6881-6889/tcp"
    #   - "6881-6889:6881-6889/udp"

volumes:
  unarr-data:

Go install

go install github.com/torrentclaw/unarr/cmd/unarr@latest

GitHub Releases

Download prebuilt binaries for Linux, macOS, and Windows from GitHub Releases.

Build from source

git clone https://github.com/torrentclaw/unarr.git
cd unarr
make build

Quick Start

# 1. Run the init wizard (opens browser for API key)
unarr init

# 2. Search for content
unarr search "breaking bad" --type show --quality 1080p

# 3. Start the download daemon
unarr start

Commands

Getting Started

Command Description
unarr init First-time configuration wizard (API key, download dir, daemon)
unarr config Edit all settings interactively (speed, organization, etc.)
unarr migrate Import settings and wanted list from Sonarr/Radarr/Prowlarr [pre-beta]

Search & Discovery

Command Description
unarr search <query> Search for movies and TV shows with advanced filters
unarr inspect <magnet|hash|name> TrueSpec analysis — quality, codec, seed health
unarr popular Show popular movies and TV shows
unarr recent Show recently added content
unarr watch <query> Find where to watch — streaming + torrents

Downloads & Streaming

Command Description
unarr download <hash|magnet> One-shot download (no daemon needed)
unarr stream <hash|magnet> Stream a torrent directly to mpv/vlc/browser

Daemon Management

Command Description
unarr start Start the download daemon (foreground)
unarr stop How to stop the running daemon
unarr status Show daemon status and active downloads
unarr daemon install Install as system service (systemd/launchd)
unarr daemon uninstall Remove the system service

System & Diagnostics

Command Description
unarr stats Show catalog statistics
unarr doctor Diagnose configuration and connectivity
unarr clean Remove temporary files, logs, and cached data
unarr self-update Update unarr to the latest version
unarr version Show version info
unarr completion <shell> Generate shell completion scripts

Search the catalog with advanced filters. Results include quality scores, seed health, and metadata from 30+ sources.

unarr search "inception" --sort seeders --min-rating 7 --lang es
unarr search "breaking bad" --type show --quality 1080p
unarr search "matrix" --json | jq '.results[].title'

Filters:

Flag Description Values
--type Content type movie, show
--quality Video quality 480p, 720p, 1080p, 2160p
--lang Audio language (ISO 639) es, en, fr, de, ...
--genre Genre Action, Comedy, Drama, Horror, ...
--year-min Minimum release year 2020
--year-max Maximum release year 2026
--min-rating Minimum IMDb/TMDb rating 0-10
--sort Sort order relevance, seeders, year, rating, added
--limit Results per page 1-50
--page Page number 1, 2, ...
--country Country for streaming info US, ES, GB, ...

Inspect

TrueSpec analysis — parse a torrent and show detailed quality specs.

unarr inspect "Oppenheimer.2023.1080p.BluRay.x265"
unarr inspect abc123def456abc123def456abc123def456abc1
unarr inspect "magnet:?xt=urn:btih:ABC123&dn=Movie.2023.1080p"

Accepts magnet URIs, 40-character info hashes, or torrent file names. Shows quality, codec, size, seeds, languages, source, quality score, health, and alternatives.

Watch

Find where to watch — streaming services alongside torrent options.

unarr watch "oppenheimer" --country ES
unarr watch "breaking bad" --json

Shows legal streaming options first (subscription, free, rent, buy), then torrent alternatives.

Stream

Stream a torrent directly to a media player without waiting for the full download.

unarr stream abc123def456abc123def456abc123def456abc1
unarr stream "magnet:?xt=urn:btih:..." --port 8080
unarr stream <hash> --player mpv
unarr stream <hash> --no-open   # just print the URL

Downloads pieces sequentially and serves the video over a local HTTP server. Auto-detects mpv, vlc, or your default browser.

Download

One-shot download by info hash or magnet link (no daemon required).

unarr download abc123def456abc123def456abc123def456abc1
unarr download "magnet:?xt=urn:btih:..." --method torrent

Daemon

The daemon receives download tasks from the web dashboard and executes them automatically.

# Start in foreground (Ctrl+C to stop)
unarr start

# Or install as a system service (auto-starts on boot)
unarr daemon install

# Check status
unarr status

# Uninstall the service
unarr daemon uninstall

The daemon connects via WebSocket for instant task delivery, with automatic HTTP fallback. It supports torrent, debrid, and usenet downloads concurrently, reports progress to the web dashboard, and handles graceful shutdown.

Service locations:

  • Linux: ~/.config/systemd/user/unarr.service (systemd)
  • macOS: ~/Library/LaunchAgents/com.torrentclaw.unarr.plist (launchd)

Diagnostics

# Run all diagnostic checks
unarr doctor

# Update to the latest version
unarr self-update
unarr self-update --force   # reinstall even if up to date

unarr doctor checks: config file, API key, server connectivity (with latency), agent registration, download directory, disk space, and version.

Clean

Remove temporary files, logs, resume data, and other artifacts generated by unarr. Shows what will be removed and asks for confirmation before deleting.

unarr clean            # Show files and confirm before removing
unarr clean --dry-run  # Show what would be removed (no prompt)
unarr clean --yes      # Skip confirmation
unarr clean --all      # Also remove the data directory

Cleans: log files, daemon state, stale usenet resume files (> 7 days), stream temp data, upgrade temp files, and stale atomic-write temps. Recent resume files are kept to preserve download progress for paused or interrupted downloads. Never removes your config file, downloaded media, or partial torrent/debrid downloads.

Alias (optional)

Create a shell alias for shorter commands:

# Add to ~/.bashrc or ~/.zshrc
alias un=unarr

# Then use:
un search "breaking bad" --type show
un popular --limit 5
un start

Global Flags

Flag Description
--json Output as JSON (for piping to jq, scripts)
--no-color Disable colored output
--api-key API key (overrides config file and env)
--config Custom config file path

JSON Output

All query commands support --json for scripting:

# Pipe to jq
unarr search "matrix" --json | jq '.results[].title'

# Save to file
unarr popular --json > popular.json

# Use in scripts
SEEDS=$(unarr search "inception" --json | jq '.results[0].torrents[0].seeders')

Configuration

Config file

Location: ~/.config/unarr/config.toml

[auth]
api_key = "tc_your_api_key_here"
api_url = "https://torrentclaw.com"

[agent]
id = "auto-generated-uuid"
name = "My PC"

[downloads]
dir = "~/Media"
preferred_method = "auto"        # auto | torrent | debrid | usenet
max_concurrent = 3
max_download_speed = "0"         # e.g. "10MB", "500KB", "0" = unlimited
max_upload_speed = "0"

[organize]
enabled = true
movies_dir = "~/Media/Movies"
tv_shows_dir = "~/Media/TV Shows"

[daemon]
poll_interval = "30s"
heartbeat_interval = "30s"

[notifications]
enabled = true

[general]
country = "US"

Streaming reference

The in-browser player on torrentclaw.com streams from the daemon over WebRTC (low-latency P2P) or HLS (HTTP fragments + ffmpeg transcode for codecs the browser can't decode natively). Both are enabled by default — a fresh install "just works" without editing the TOML. Disable surgically only if you have a reason.

[downloads.webrtc]
enabled       = true                                    # master switch
trackers      = ["wss://tracker.torrentclaw.com"]      # signaling trackers
stun_servers  = [                                       # NAT traversal
  "stun:stun.l.google.com:19302",
  "stun:stun1.l.google.com:19302",
]
turn_servers  = []                                      # optional TURN relays
turn_user     = ""
turn_pass     = ""

[downloads.transcode]
enabled        = true        # master switch
hw_accel       = "auto"      # auto | none | nvenc | qsv | vaapi | videotoolbox
preset         = "veryfast"  # libx264 preset
video_bitrate  = ""          # e.g. "5M" caps -b:v; empty = engine fallback (5M)
audio_bitrate  = "192k"      # e.g. "128k", "192k", "256k"
max_height     = 0           # 0 = no cap; e.g. 720 forces 720p max
max_concurrent = 2           # max simultaneous ffmpeg processes

[downloads.webrtc]

Key Type Default Notes
enabled bool true Browser↔daemon WebRTC peer for the in-browser P2P player. Disable to skip WebRTC tracker signalling (saves ~5MB RAM, blocks WebRTC streaming — HLS still works).
trackers []string ["wss://tracker.torrentclaw.com"] Signaling trackers for peer discovery.
stun_servers []string Google public STUN ×2 ICE candidate gathering.
turn_servers []string [] Optional TURN relays for symmetric-NAT users.
turn_user / turn_pass string "" Credentials for authed TURN servers. Applied to all turn_servers.

[downloads.transcode]

Key Type Default Notes
enabled bool true Real-time HLS transcoding when source codec is browser-incompatible (HEVC, AV1, AC3, DTS). Requires ffmpeg + ffprobe on PATH.
hw_accel string "auto" Hardware accel: "auto", "none", "nvenc" (NVIDIA), "qsv" (Intel), "vaapi" (Linux), "videotoolbox" (macOS).
preset string "veryfast" libx264 preset. Slower preset = smaller files but higher CPU. Options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow.
video_bitrate string "" E.g. "5M" caps -b:v. Empty falls back to the engine default (5M).
audio_bitrate string "192k" E.g. "128k", "256k".
max_height int 0 0 = no cap. E.g. 720 forces 720p max — useful on weak GPUs.
max_concurrent int 2 Max simultaneous ffmpeg processes. Increase if hosting multiple users on a beefy box.

If transcode.enabled = true but ffmpeg / ffprobe aren't on PATH, the daemon logs a warning at startup and HLS sessions are rejected at runtime with a clear error — install ffmpeg or set enabled = false.

Environment variables

Environment variables override config file values:

export UNARR_API_KEY=tc_your_api_key
export UNARR_API_URL=https://torrentclaw.com
export UNARR_COUNTRY=ES
export UNARR_DOWNLOAD_DIR=~/Media

Speed limits

Speed limits use human-readable format:

max_download_speed = "10MB"    # 10 megabytes/sec
max_upload_speed = "1MB"       # 1 megabyte/sec
max_download_speed = "500KB"   # 500 kilobytes/sec
max_download_speed = "0"       # unlimited (default)

Shell Completion

Generate tab-completion scripts for your shell:

# Bash — add to ~/.bashrc
eval "$(unarr completion bash)"

# Zsh — add to ~/.zshrc
eval "$(unarr completion zsh)"

# Fish
unarr completion fish > ~/.config/fish/completions/unarr.fish

# PowerShell — add to $PROFILE
unarr completion powershell >> $PROFILE

Completions provide tab-completion for commands, flags, and flag values (e.g. --type <Tab> shows movie and show).

Coming Soon

These commands are planned for future releases:

Command Description
unarr upgrade Find a better version of a torrent
unarr moreseed Find same quality with more seeders
unarr compare Compare two torrents side by side
unarr scan Scan your media library for upgrades
unarr add Search and add torrents to your client
unarr monitor Watch for new episodes of a series
unarr open Open content in the browser

Contributing

See CONTRIBUTING.md for development setup, code style, and guidelines.

License

MIT License — see LICENSE for details.