MCPcopy Index your code
hub / github.com/estevaom/trackwatch

github.com/estevaom/trackwatch @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
202 symbols 338 edges 20 files 11 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

trackwatch

A beautiful terminal music visualizer with pixelated album art and synchronized lyrics

CI codecov License: MIT Rust


Features

  • 🎵 Universal Player Support - Works with YouTube, Spotify, Tidal, VLC, and any MPRIS2-compatible player
  • 🎨 Pixelated Album Art - 30x30 pixel art rendered with ANSI escape sequences (including YouTube video thumbnails!)
  • 🌈 Dynamic Color Theming - Extracts colors from album art for UI elements
  • 📝 Synchronized Lyrics - Auto-scrolling lyrics with LRC format support
  • 💾 Smart Caching - Caches processed images and lyrics for performance
  • Real-time Updates - Live progress tracking and metadata updates

Requirements

  • Rust 1.70+
  • playerctl (for media player detection)
  • Terminal with 256 color support
  • Tidal API credentials (optional, for enhanced metadata)

Installation

# Clone the repository
git clone https://github.com/estevaom/trackwatch
cd trackwatch

# Build and run
cargo build --release
./target/release/trackwatch

Optional: Enhanced Metadata with Tidal

For richer album metadata and high-quality cover art, you can optionally configure Tidal API credentials:

  1. Get Tidal API credentials from https://developer.tidal.com/dashboard/create
  2. Create a .env file from the example:

bash cp .env.example .env

  1. Edit the .env file with your credentials:

TIDAL_CLIENT_ID=your_client_id TIDAL_CLIENT_SECRET=your_client_secret

Note: Tidal integration is entirely optional. trackwatch works perfectly fine without it, using metadata and album art from your media player (playerctl).

Controls

  • q or Esc - Quit the application

How It Works

  1. Player Detection: Uses playerctl to monitor any MPRIS2-compatible media player
  2. Metadata Enrichment: Fetches additional data from Tidal API when configured (optional)
  3. Album Art Processing: Downloads and converts images to 30x30 pixelated format
  4. Color Extraction: Uses k-means clustering in LAB color space for palette generation
  5. Lyrics Fetching: Downloads from LRCLIB API with intelligent caching
  6. UI Rendering: Updates every 500ms with smooth animations and color transitions

Architecture

  • Two-thread model: Main thread for UI, background thread for data fetching
  • Shared state: Thread-safe communication via Arc<Mutex<App>>
  • Hybrid async/sync: Synchronous playerctl polling with async API calls
  • Graceful degradation: Falls back to basic metadata when services unavailable

Building from Source

# Development build
cargo build

# Run with debug output
RUST_LOG=debug cargo run

# Run tests
cargo test

# Generate documentation
cargo doc --open

CI/CD

This project uses GitHub Actions for continuous integration and deployment:

Automated Checks

  • Code Formatting: Enforces consistent style with cargo fmt
  • Linting: Catches common mistakes with cargo clippy
  • Testing: Runs the full test suite (65+ tests)
  • Code Coverage: Tracks test coverage with Codecov
  • Cross-platform Builds: Builds for x86_64 and aarch64 Linux

Release Process

The CI pipeline automatically:

  1. Runs all quality checks on every push/PR
  2. Generates code coverage reports
  3. Creates release artifacts for multiple architectures
  4. Caches dependencies for faster builds

Running CI Locally

You can run the same checks locally before pushing:

# Format code
cargo fmt

# Run linter
cargo clippy -- -D warnings

# Run tests with coverage
cargo install cargo-tarpaulin
cargo tarpaulin --out Xml

# Build release binary
cargo build --release

Cache Location

  • Images: ~/.cache/trackwatch/
  • Lyrics: ~/.cache/trackwatch/lyrics/

License

MIT

Acknowledgments

  • Ashish Kumar (@ash1sh0kumar) for creating mufetch, the incredible terminal music visualizer that inspired this project. His work sparked the idea to build trackwatch and explore terminal-based media visualization.
  • The Tidal API for media metadata
  • The ratatui community for excellent TUI examples
  • playerctl for universal media player support

    Made by Estevao Machado

Extension points exported contracts — how you extend this code

MusicProvider (Interface)
For watch mode, we only need album metadata [1 implementers]
src/providers/mod.rs

Core symbols most depended-on inside this repo

get
called by 40
src/lyrics/cache.rs
format_info_line
called by 15
src/display/formatter.rs
generate_key
called by 10
src/lyrics/cache.rs
parse_lrc_line
called by 9
src/lyrics/parser.rs
render
called by 6
src/progress.rs
generate_cache_key
called by 6
src/cache.rs
create_tidal_provider
called by 5
src/provider_factory.rs
parse_lrc
called by 5
src/lyrics/parser.rs

Shape

Function 101
Method 71
Class 29
Interface 1

Languages

Rust100%

Modules by API surface

src/colors.rs25 symbols
src/providers/tidal/api.rs19 symbols
src/display/formatter.rs19 symbols
src/player.rs15 symbols
src/ui/mod.rs14 symbols
src/models/mod.rs14 symbols
src/lyrics/parser.rs14 symbols
src/cache.rs14 symbols
src/lyrics/api.rs12 symbols
src/progress.rs10 symbols
src/config.rs10 symbols
src/lyrics/mod.rs9 symbols

For agents

$ claude mcp add trackwatch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact