dart_cue 0.1.1
dart_cue: ^0.1.1 copied to clipboard
A pure Dart CUE sheet parser and serialiser for album, track, and index metadata with lossless round-trip support and no runtime dependencies.
Changelog #
0.1.1 #
- Parser normalisation: a quoted
CATALOGvalue is unquoted, andISRCvalues are unquoted and upper-cased, so sheets from rippers that quote or lower-case these no longer fail validation. validateCueSheetalso checks INDEX numbers are in range (0-99).CueTrack.fromJsonnow throws aFormatExceptionon a malformedindicestimestamp instead of silently substituting00:00:00.cueinfoCLI:--formatgiven without a value reports "missing value" instead of "unknown option"; an invalid--formatis rejected before the file is read; barecueinfoprints usage to stderr (exit 2) while-h/--helpkeeps printing to stdout (exit 0).CueIssueSeverity.errordocumented as reserved — the permissive parser andvalidateCueSheetcurrently only emit warnings.
0.1.0 #
-
Breaking:
CueSheet,CueFileandCueTrackconstructors now defensively copy their collection arguments (files,remComments,tracks,flags,indices) into unmodifiable collections, and the defaults for omitted arguments are unmodifiable too. Previously only parsed sheets were unmodifiable; hand-built models exposed the caller's live mutable collections, socopyWithcopies shared mutable state with their source. Code that built a model and mutated its collections afterwards (e.g.sheet.files.add(...)) will now throwUnsupportedError— build the full collection first and pass it to the constructor, or usecopyWithwith a replacement collection. -
Writer: values that are empty or contain a double quote are now written quoted (
FILE "" WAVE,TITLE "ab"cd"), so such sheets survive a write → parse round-trip instead of losing the FILE entry or emitting ambiguous output. CUE has no escape syntax for embedded quotes; the value is wrapped verbatim, which the parser reads back losslessly. -
formatMsfno longer drops the sign of a negative duration: a corrupt sheet whose INDEX 01 times run backwards now formats its (negative) track duration as-mm:ss:ffinstead of a plausible-looking positive value. -
Diagnostics:
parseCueSheetWithDiagnosticsnow reports lines that match no CUE command at all ("unrecognised line") and duplicateINDEXnumbers within a track (later value still wins). A bareREMline is treated as an empty comment and not reported. -
validateCueSheetadditionally checks thatINDEX 01times increase monotonically across the tracks of each FILE. -
Dev dependencies:
lints4 → 6; removed the now-flagged library name fromlib/dart_cue.dart. -
GitHub Actions CI (
.github/workflows/ci.yml): format check, analyser with--fatal-warnings, test matrix (Ubuntu/macOS/Windows × Dart stable & beta), web-compile smoke test, dartdoc dry-run andpub publish --dry-run. -
GitHub Actions release workflow (
.github/workflows/release.yml): onv*tag push, compiles thecueinfobinary for linux-x64, macos-arm64 and windows-x64, packages it and attaches the artefacts to the GitHub release. -
dart_test.yamldocuments theclitag used by the subprocess integration tests.
0.0.6 #
copyWithonCueSheet,CueFileandCueTrack. Returns a new instance with any named argument replaced; omitted fields keep their current value.CueTrack.copyWithcarriesendTimethrough and accepts a replacement for it.- JSON serialisation:
toJson()and staticfromJson(Map<String, Object?>)on all three model classes. MSF durations are written asmm:ss:ffstrings; enums as CUE labels; optional fields omitted when null. Round-trips losslessly —CueSheet.fromJson(sheet.toJson())equalssheet. Closes #7.
0.0.5 #
- Web platform support.
parseCueSheet,parseCueBytes,toCueStringand every model class now compile to JS and run in the browser. Filesystem access viaparseCueFileis behind conditional imports — available on the Dart VM and Flutter (mobile, desktop) as before; on the web it throwsUnsupportedErrorwith a clear message pointing callers atparseCueBytes. Closes #6. parseCueSheetWithDiagnostics(String)returns aParseResult { sheet, issues }with line-numbered warnings for unknown FILE/TRACK/FLAGS tokens, malformed INDEX/PREGAP/POSTGAP timestamps, out-of-place commands and non-numeric TRACK numbers. The defaultparseCueSheetstays permissive and silent. Structural checks (missingINDEX 01, non-monotonic track numbers, malformedCATALOG/ISRC, …) are also exposed asvalidateCueSheet(CueSheet)for hand-built sheets. New exported types:CueIssue,CueIssueSeverity,ParseResult. Thecueinfo validatesubcommand now uses the library implementation. Closes #4.
0.0.4 #
- Fix pub.dev scoring: escape angle brackets in
bin/cueinfo.dartdoc comments, wrap single-statementifbodies in blocks to satisfycurly_braces_in_flow_control_structures, and re-rundart formatacross the tree. No behavioural changes.
0.0.3 #
CueSheet.replayGainAlbumGain/replayGainAlbumPeakandCueTrack.replayGainTrackGain/replayGainTrackPeakconvenience getters. Strip an optionaldBsuffix (case-insensitive) from the gain values and returndouble?. Closes #5.
0.0.2 #
CueSheet,CueFileandCueTracknow have structural==,hashCodeandtoStringimplementations, so parsed sheets can be compared, put inSets, or keyed inMaps by their content. Equality covers every constructor field plus the mutableCueTrack.endTime. Closes #3.
0.0.1 #
Initial release.
Features #
- Parse CUE sheets from a
String(parseCueSheet), raw bytes (parseCueBytes) or a file path (parseCueFile). - Serialise a
CueSheetback to CUE-format text withtoCueString; lossless round-trip for all supported constructs. - Album-level metadata:
CATALOG,CDTEXTFILE,PERFORMER,SONGWRITER,TITLE, arbitrary and well-knownREMfields (GENRE,DATE/YEAR,DISCNUMBER,DISCID,COMMENT, …). CueSheet.barcodeconvenience getter that falls back throughCATALOG→REM UPC→REM BARCODEfor callers that just want the disc barcode regardless of which command the ripper used (#2).- File types:
WAVE,MP3,AIFF,AIFC,BINARY,MOTOROLA. - Track types:
AUDIO,CDG,MODE1/2048,MODE1/2352,MODE2/2336,MODE2/2352,CDI/2336,CDI/2352,DATA. - Track-level
TITLE,PERFORMER,SONGWRITER,ISRC,PREGAP,POSTGAP, multipleINDEXentries, track-scopedREMcomments (includingREPLAYGAIN_TRACK_*). FLAGS:DCP,4CH,PRE,SCMS,DATA.- MSF (
mm:ss:ff, 75 fps) parse/format with frame-accurate round-trip. - Automatic derivation of each track's
endTimeanddurationfrom the next track'sINDEX 01. - Encoding handling: UTF-8 / UTF-16 LE / UTF-16 BE byte-order marks detected and stripped; Latin-1 fallback for legacy Windows-ripper sheets.
- Permissive parser: malformed MSF values, unknown tokens, out-of-place commands and mixed-case keywords are tolerated without throwing.
cueinfoCLI (installable viadart pub global activate dart_cue) withinfo,validate,reformatandtrackssubcommands.- Parsed
CueSheetcollections (files,remComments,tracks,indices,flags) are unmodifiable, so the model is safe to share across isolates without defensive copies.