User:PBryan/metagrep

From MusicBrainz Wiki
Jump to navigationJump to search

metagrep

Description

The metagrep script will recursively walk a directory containing FLAC files, and find tracks with metadata matching a pattern.

Dependencies

Notes

  • This script is tested on Ubuntu 8.10; mileage may vary on other platforms.

Download

License

Usage

Usage: metagrep [options] pattern [flac_dir]

Options

  • Option Description Default
    --help Display this help message.
    --[no]insensitive Case-insensitive pattern matching. noinsensitive
    --[no]invert Show tracks that do not have matching pattern. noinvert
    --[no]listonly Only display name of matching files. nolistonly
    --metaflac=program Program to call to read metadata in FLAC file. metaflac
    --quiet Quiet operation, no screen output.
    --tmp=directory Directory to store temporary files in. /tmp
    --verbose Verbose output of progress information.

Patterns

The pattern you provide is a standard Perl regular expression. Metadata tags are represented in FLAC files as name=value pairs. The entire tag is matched against the pattern.

Examples

Search for tracks where track number is 1:

  • metagrep ^TRACKNUMBER=1$

Search for tracks with the word "love" in the track title (case insensitive):

  • metagrep --insensitive ^TITLE=.*love

List tracks with the title "Rhapsody in Blue":

  • metagrep --listonly "^TITLE=Rhapsody in Blue$"

Search for tracks with a MusicBrainz track identifier:

  • metagrep ^MUSICBRAINZ_TRACKID=

Search for tracks with a MusicIP PUID:

  • metagrep ^MUSICIP_PUID=

Search for tracks missing a MusicIP PUID:

  • metagrep --invert ^MUSICIP_PUID=

Configuration file

You can store persistent command-line options in a file called .metagrep in your home directory. They will be read as defaults prior to processing any passed command-line options.

Changelog

0.1 (2009-01-18)

  • Initial version released to MusicBrainz.