Skip to content

Ravneetsb/bragi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bragi

Bragi is a small Rust command-line tool for organizing and playing a local music library. It scans the current directory for MP3 and FLAC files, reads track metadata, and moves songs into an All_Songs/<Artist>/<Album>/<Title>.<ext> library layout.

It can also open tracks through the system audio player and create portable M3U playlists from the sorted library.

Features

  • Sort MP3 and FLAC files by artist, album, and title metadata.
  • Keep FLAC files when both FLAC and MP3 versions of a track are present.
  • Sanitize generated folder and file names for filesystem compatibility.
  • Reuse existing artist and album folder casing when possible.
  • Browse and play sorted tracks with an interactive fuzzy picker.
  • Create M3U playlists interactively, randomly, from filters, or by importing an existing .m3u or .m3u8 playlist.

Requirements

  • Rust toolchain with Cargo.
  • A terminal that can run interactive skim pickers for play and interactive playlist creation.
  • A system application associated with audio files for bragi play.

Installation

Clone the repository and build the binary:

cargo build --release

The optimized binary will be written to target/release/bragi.

For local development, run commands through Cargo:

cargo run -- --help

Usage

Run Bragi from the root of the music directory you want to manage. The sorter creates and maintains an All_Songs directory in the current working directory.

Sort Music

cargo run -- sort

Running without a subcommand also sorts music:

cargo run

The sorter skips files without usable metadata and prints a summary of moved files, skipped conflicts, and read errors.

Play a Track

cargo run -- play

This reads tracks from All_Songs, opens an interactive fuzzy picker, and opens the selected file with the system default audio application.

Create Playlists

Playlists are written to Playlists/<name>.m3u with paths relative to the playlist file.

Create a playlist from an interactive multi-select picker:

cargo run -- playlist --name Favorites

Create a random playlist:

cargo run -- playlist --name Shuffle --random 25

Filter playlist candidates by artist, album, or genre:

cargo run -- playlist --name Jazz --genre jazz
cargo run -- playlist --name Beatles --artist "The Beatles"
cargo run -- playlist --name Roadtrip --artist "Nina Simone" --album "Pastel Blues"

Import an existing M3U or M3U8 playlist and match entries against the sorted library:

cargo run -- playlist --name Imported --import ~/Music/old-playlist.m3u

--import cannot be combined with --random, --artist, --album, or --genre.

Library Layout

Bragi organizes supported audio files into:

All_Songs/
  Artist/
    Album/
      Title.flac
      Other Title.mp3
Playlists/
  Favorites.m3u

Only .mp3 and .flac files are currently supported.

Anti-Piracy

Bragi is intended for personal music libraries built from music bought or otherwise obtained through official sources, such as purchased downloads, ripped personal CDs, or other authorized collections.

Users are responsible for complying with copyright law and the terms of the stores, services, and licenses that apply to their music. This project does not endorse piracy or unauthorized distribution.

Development

Useful commands:

cargo check
cargo test
cargo fmt --check
cargo clippy --all-targets --all-features

Run cargo fmt before committing code changes.

Notes

Bragi operates on files under the current working directory. Before running it against an important library for the first time, use a backup or a copy of a small subset to confirm the resulting layout matches your expectations.

About

Organize my files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages