Syndication Icon
Published April 21, 2014 Updated October 21, 2021
FLACsmith Icon

FLACsmith

Git Badge
Gem Version
Alchemists Style Guide
Circle CI Status

This gem is a Ruby wrapper for FLAC commands. FLACsmith aids in listing/rebuilding metadata for a music collection, artist, album, or song. Having metadata information that reflects the directory/file structure makes organizing and managing large music collections easier. This can be especially useful with tools like IINA.

Features

  • Converts source audio (AIFF) to FLAC.

  • Rebuilds metadata for a file, album, artist, or music collection.

  • Lists metadata for a file, album, artist, or music collection.

Requirements

  1. A UNIX-based system.

  2. Ruby.

  3. FLAC.

Setup

To install, run:

gem install flacsmith

Usage

From the command line, type: pennyworth

flacsmith -C, [--convert=INPUT_DIR OUTPUT_DIR]  # Convert source audio to FLAC audio.
flacsmith -h, [--help=COMMAND]                  # Show this message or get help for a command.
flacsmith -l, [--list=PATH]                     # List track metadata for given folder/file structure.
flacsmith -r, [--rebuild=PATH]                  # Rebuild track metadata for given folder/file structure.
flacsmith -v, [--version]                       # Show gem version.

The following directory structure is assumed: /<artist>/<album>/<tracknumber> <title>.flac. This is important because metadata for a file is always rebuilt by inspecting the absolute path to the file which assumes that a song is nested within an artist and album folder and has a track number followed by a title. This convention over configuration technique allows metadata to be rebuilt by inspecting the absolute path of the file. This also means that the --rebuild option can be applied to a single song, album, artist, or a complete music collection.

The following is an example of potential workflows:

  • Convert AIFF files to FLAC files:

    • Run: flacsmith -C <input dir> <output dir>

  • List metadata for an artist:

    • Run: flacsmith -l <artist>

  • List metadata for an album:

    • Run: flacsmith -l <artist>/<album>

  • List metadata for collection:

    • Run: flacsmith -l .

  • Rebuild metadata for a new album:

    • Copy the album to <collecton>/<artist>/<album>

    • Run: flacsmith -r <collecton>/<artist>/<album>

  • Rebuild metadata for a song:

    • Change directory to <collecton>/<artist></album>

    • Run: mv <old name>.flac to <new name>.flac

    • Run: flacsmith -r <new name>.flac

  • Rebuild metadata for entire music collection:

    • Run: flacsmith -r .

Development

To contribute, run:

git clone https://github.com/bkuhlmann/flacsmith.git
cd flacsmith
bin/setup

You can also use the IRB console for direct access to all objects:

bin/console

Tests

To test, run:

bundle exec rake

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.

  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.

Code of Conduct

Read Code of Conduct for details.

Contributions

Read Contributions for details.

License

Read License for details.

History

Read Changes for details.

Credits

Engineered by Brooke Kuhlmann.