Parser Commands

The parser branch provides commands for parsing and analyzing media metadata files. This is primarily a diagnostic tool for troubleshooting import and metadata issues.

Overview

mcli parser [COMMAND] [OPTIONS]

Available Commands:

Command Description
parse Parse a media file and show extracted metadata

parser parse

Parses various music metadata files and extracts information for inspection.

Usage

mcli parser parse <FILENAME> [OPTIONS]

Arguments

Argument Required Description
FILENAME Yes Path to the file to parse

Options

Option Alias Default Description
--verbose   true Show detailed parsing results in JSON format

Supported File Types

Extension Type Description
.cue CUE Sheet Track listings with timestamps for splitting
.nfo NFO File Release information and metadata
.sfv SFV File Simple File Verification checksums
.m3u M3U Playlist Playlist files with track ordering

CUE Sheet Parsing

CUE sheets describe how to split a single audio file into multiple tracks.

Example

./mcli parser parse "/path/to/album.cue"

Sample CUE File

PERFORMER "The Beatles"
TITLE "Abbey Road"
FILE "abbey_road.flac" WAVE
  TRACK 01 AUDIO
    TITLE "Come Together"
    PERFORMER "The Beatles"
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    TITLE "Something"
    PERFORMER "The Beatles"
    INDEX 01 04:20:00

Output

{
  "Type": "CUE",
  "IsValid": true,
  "Artist": "The Beatles",
  "Album": "Abbey Road",
  "AudioFile": "abbey_road.flac",
  "Tracks": [
    {
      "Number": 1,
      "Title": "Come Together",
      "Artist": "The Beatles",
      "StartTime": "00:00:00",
      "Duration": "04:20"
    },
    {
      "Number": 2,
      "Title": "Something",
      "Artist": "The Beatles",
      "StartTime": "04:20:00",
      "Duration": null
    }
  ]
}

NFO File Parsing

NFO files contain release information, often in scene releases.

Example

./mcli parser parse "/path/to/album.nfo"

Sample NFO Content

Artist......: The Beatles
Album.......: Abbey Road
Year........: 1969
Genre.......: Rock
Tracks......: 17
Quality.....: FLAC / Lossless

Output

{
  "Type": "NFO",
  "IsValid": true,
  "Artist": "The Beatles",
  "Album": "Abbey Road",
  "Year": 1969,
  "Genre": "Rock",
  "TrackCount": 17,
  "Quality": "FLAC / Lossless"
}

SFV File Parsing

SFV files contain CRC32 checksums for file verification.

Example

./mcli parser parse "/path/to/album.sfv"

Sample SFV Content

; Generated by sfv tool
01 - Come Together.mp3 A1B2C3D4
02 - Something.mp3 E5F6G7H8
03 - Maxwell's Silver Hammer.mp3 I9J0K1L2

Output

{
  "Type": "SFV",
  "IsValid": true,
  "Files": [
    {
      "Filename": "01 - Come Together.mp3",
      "Checksum": "A1B2C3D4",
      "Exists": true,
      "Valid": true
    },
    {
      "Filename": "02 - Something.mp3",
      "Checksum": "E5F6G7H8",
      "Exists": true,
      "Valid": true
    }
  ],
  "Summary": {
    "Total": 3,
    "Valid": 3,
    "Missing": 0,
    "Corrupted": 0
  }
}

M3U Playlist Parsing

M3U files are playlists that list audio files in order.

Example

./mcli parser parse "/path/to/playlist.m3u"

Sample M3U Content

#EXTM3U
#EXTINF:259,The Beatles - Come Together
/music/The Beatles/Abbey Road/01 - Come Together.mp3
#EXTINF:182,The Beatles - Something
/music/The Beatles/Abbey Road/02 - Something.mp3

Output

{
  "Type": "M3U",
  "IsValid": true,
  "Format": "Extended M3U",
  "Entries": [
    {
      "Path": "/music/The Beatles/Abbey Road/01 - Come Together.mp3",
      "Duration": 259,
      "Title": "The Beatles - Come Together",
      "Exists": true
    },
    {
      "Path": "/music/The Beatles/Abbey Road/02 - Something.mp3",
      "Duration": 182,
      "Title": "The Beatles - Something",
      "Exists": true
    }
  ],
  "TotalDuration": "7:21",
  "TrackCount": 2
}

Use Cases

Debugging Import Issues

# Check why CUE sheet isn't being processed correctly
./mcli parser parse "/path/to/problem.cue"

# Verify NFO metadata extraction
./mcli parser parse "/path/to/release.nfo"

Validating File Integrity

# Check SFV for corrupted files
./mcli parser parse "/path/to/album.sfv"

Analyzing Release Structure

# Understand a release's organization
./mcli parser parse "/path/to/album.cue"
./mcli parser parse "/path/to/album.nfo"
./mcli parser parse "/path/to/album.sfv"

Scripting

#!/bin/bash
# Parse all CUE files in a directory

for cue in *.cue; do
    echo "=== $cue ==="
    ./mcli parser parse "$cue" | jq '.Tracks | length'
done

Error Handling

Invalid File

{
  "Type": "CUE",
  "IsValid": false,
  "Error": "Invalid CUE syntax at line 15",
  "Line": 15,
  "Content": "TRACK 01 INVALID"
}

Missing Referenced Files

{
  "Type": "CUE",
  "IsValid": true,
  "Warnings": [
    "Referenced audio file not found: abbey_road.flac"
  ]
}

Unsupported Format

Error: Unsupported file type: .xyz
Supported types: .cue, .nfo, .sfv, .m3u

See Also