Tree


.gitignorecommits | blame
CHANGELOG.mdcommits | blame
Cargo.lockcommits | blame
Cargo.tomlcommits | blame
LICENSEcommits | blame
README.mdcommits | blame
cliff.tomlcommits | blame
flake.lockcommits | blame
flake.nixcommits | blame
hack/
prek.tomlcommits | blame
src/

README.md

# hakuna

A command-line tool that fetches music metadata (genres and labels) from Discogs or MusicBrainz and writes them to audio files.

## Features

* Fetch metadata (genres, labels) from Discogs or MusicBrainz
* Write metadata to audio file tags
* Process directories recursively
* Manually edit artist, album, genre, and label tags
* Batch edit multiple files with the same values

## Building

To build the project, run:

```sh
cargo build --release
```

## Usage

```sh
./target/release/hakuna [OPTIONS] [PATH]...
```

### Arguments

*   `<PATH>...`: One or more files or directories to analyze.

### Options

*   `--artist <ARTIST>`: Artist name for metadata lookup.
*   `--album <ALBUM>`: Album name for metadata lookup.
*   `--read`: Read tags from file and show proposed metadata.
*   `--write`: Write fetched metadata to audio file tags.
*   `-e`, `--edit`: Manually edit artist, album, genre, and label tags.
*   `-a`, `--all`: Process all files in directory(ies) at once (use with `--edit` or `--write`).
*   `-d`, `--discogs-token <TOKEN>`: Discogs API token for better results.
*   `-h`, `--help`: Print help information.
*   `-V`, `--version`: Print version information.

### Example

```sh
# Fetch metadata for an artist and album
./target/release/hakuna --artist 'The Beatles' --album 'Abbey Road'

# Read tags from a single file
./target/release/hakuna --read file.flac

# Write metadata to a single file
./target/release/hakuna -d DISCOGS_TOKEN --write file.flac

# Edit tags for a single file (interactive)
./target/release/hakuna --edit file.flac

# Write metadata to all files in a directory
./target/release/hakuna -d DISCOGS_TOKEN --write --all /path/to/music/

# Batch edit all files in a directory with the same values
./target/release/hakuna --edit --all /path/to/music/
```

## API Credentials

The tool can use either Discogs or MusicBrainz.

*   **Discogs (Recommended):** For better results, especially for genre and label information, a Discogs token is required. You can get one from your Discogs developer settings.

    Pass the token via command line:
    ```bash
    hakuna -d DISCOGS_TOKEN --write file.flac
    ```

*   **MusicBrainz (Fallback):** If no Discogs token is provided, the tool will fall back to using the MusicBrainz API, which does not require authentication. Results might be less detailed.