The letter A styled as Alchemists logo. lchemists Syndication Icon

Putin's War on Ukraine - Watch President Zelenskyy's speech and help Ukraine fight against the senseless cruelty of a dictator!

Published April 21, 2014 Updated May 28, 2022
FLACsmith Icon

FLACsmith

10.1.0

This gem is a Ruby wrapper for FLAC metadata. FLACsmith aids in listing/rebuilding metadata for a music collection, artist, album, or track. 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: flacsmith --help

FLACsmith - A command line interface for managing FLAC metadata.

USAGE:
  -e, --encode SOURCE_DIR,TARGET_DIR       Encode source audio as FLAC audio.
  -h, --help                               Show this message.
  -l, --list SOURCE_DIR                    List track metadata for source directory.
  -r, --rebuild SOURCE_DIR                 Rebuild track metadata for source directory.
  -v, --version                            Show gem version.

ENCODE OPTIONS:
  -i, --image PATH                         Album image file path.

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 --encode "<source_dir>,<target_dir>" --image "<image_path>"

  • List metadata for an artist:

    • Run: flacsmith --list "<artist>"

  • List metadata for an album:

    • Run: flacsmith --list "<artist>/<album>"

  • List metadata for collection:

    • Run: flacsmith --list .

  • Rebuild metadata for a new album:

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

    • Run: flacsmith --rebuild "<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 --rebuild "<new name>.flac"

  • Rebuild metadata for an entire music collection:

    • Run: flacsmith --rebuild .

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

Credits