# virittaa
A command-line tool that analyzes audio files to detect `BPM` and `Key` tags.
## Features
* Detect BPM and Key of audio files
* Write detected BPM and Key to metadata tags
* Save track metadata to a database
## Building
To build the project, run:
```sh
cargo build --release
```
## Usage
```sh
./target/release/virittaa [OPTIONS] [PATH]...
```
### Arguments
* `[PATH]...`: One or more files or directories to analyze. Not required when using `--list` or `--query`.
### Options
* `-w`, `--write`: Write detected BPM and Key to audio file metadata.
* `-f`, `--force`: Re-analyze files even if they already have BPM/Key tags.
* `-j`, `--jobs <JOBS>`: Number of threads to use (0 = all cores).
* `-S`, `--save`: Save track reports (artist, track, BPM, key) to the database.
* `-l`, `--list`: List all track reports stored in the database.
* `--query <KEY>`: Look up a track report by artist - track key.
* `--db-path <PATH>`: Path to the database directory (default: `~/.local/share/virittaa`).
* `-h`, `--help`: Print help information.
* `-V`, `--version`: Print version information.
### Examples
```sh
# Analyze a single file
./target/release/virittaa /path/to/track.mp3
# Analyze a directory and write metadata tags
./target/release/virittaa --write /path/to/music/
# Re-analyze files that already have tags
./target/release/virittaa --force --write /path/to/music/
# Limit to 4 threads
./target/release/virittaa -j 4 /path/to/music/
# Analyze and save reports to database
./target/release/virittaa --save /path/to/music/
# Write tags and save to database with custom path
./target/release/virittaa -w --save --db-path ~/my_library /path/to/music/
# List all tracks in the database
./target/release/virittaa --list
# Look up a specific track
./target/release/virittaa --query "Aphex Twin - Xtal"
# Query using a custom database path
./target/release/virittaa --list --db-path ~/my_library
```