GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • trackparse
  • GitHub
  • npm
  • PyPI
  • crates.io
  • pkg.go.dev

This view

  • Original page
  • New address

GeezerVison is showing 4matic.github.io — A parser for track names and tracklists

Messy track names in.
Structured data out.

trackparse reads track titles the way people write them in store metadata, YouTube uploads and the tracklist under a mix. Artists and their roles, remixes and other versions, and the noise around them each get a field of their own. It is one spec with packages for JavaScript, Python, Rust, Go and C.
Get startedOpen the playground
$ npm install trackparse

Published on npm, PyPI, crates.io and the Go module proxy; the C library is a tarball on GitHub Releases. The Rust API docs are on docs.rs, the Go API docs on pkg.go.dev, the C API in the C README.

Track name

Extract, don't delete

Section titled “Extract, don't delete”

Most title parsers split on the dash and hand you two strings. Others "clean" the title and throw the featured artist and the remix away with the brackets.

trackparse keeps everything. What it recognizes goes into a labeled field, and what it doesn't stays in the title, word for word.

input 01. Wilkinson ft. Becky Hill & Tom Cane - Afterglow (Sub Focus VIP Remix) [Official Video]

Split on the dashtrackparse
ArtistWilkinson ft. Becky Hill & Tom CaneWilkinson
FeaturedlostBecky Hill, Tom Cane
TitleAfterglow (Sub Focus VIP Remix) [Official Video]Afterglow
Versionlostremix + vip, by Sub Focus
NoiselostOfficial Video  video
Positionlost1

What you get

Section titled “What you get”
  1. 01

    Credits with roles

    Primary artists, features, producers and remixers, each with the joiner it was written with. Skrillex & Diplo x Justin Bieber is three artists; with knownArtists, Chase & Status stays one.

  2. 02

    27 version types

    Remix, VIP, bootleg, extended, radio edit, live, remaster, sped up, slowed and the rest, each with its remixers, modifiers and year.

  3. 03

    Noise, labeled

    [Official Video], [HD], - YouTube and [NCS Release] leave the title but land in junk with a kind, instead of disappearing.

  4. 04

    Whole tracklists

    Paste the tracklist of a mix: every line is parsed, times are checked, and an out-of-order time often comes with the fix. Edits rewrite only the lines you name.

  5. 05

    One spec, five languages

    The npm package, the PyPI package, the Rust crate, the Go module and the C library pass the same 13,565 fixtures and return byte-identical JSON on every fixture input. The ports page has the one known Unicode difference.

  6. 06

    Small and total

    The JavaScript package is about 18 kB gzipped. It, the Python package and the Go module have no dependencies, and the C library needs only the C standard library and threads; the Rust crate has one, unicode-normalization. The scanners are written by hand and no regex backtracks, so a 10,000-code-point input takes at most tens of milliseconds in JavaScript, Rust, Go and C, and well under a second in Python. No string makes it throw or panic, and bad options fall back to defaults.

shared fixtures, 100% passing in all five ports
13,565
runtime dependencies in JavaScript, Python, Go and C, one in Rust
0
version types, remix to nightcore
27
differences between JS, Python, Rust, Go and C output on the fixtures
0

Same call, same answer

Section titled “Same call, same answer”
  • JavaScript
  • Python
  • Rust
  • Go
  • C
import { parse } from "trackparse";
const track = parse("Noisia feat. Foreign Beggars - Shellshock");
track.artists.map((a) => `${a.name} (${a.role})`);
// [ 'Noisia (primary)', 'Foreign Beggars (featured)' ]
parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").versions[0];
// { type: 'live', descriptor: 'at Wembley', year: 1986, … }
from trackparse import parse
track = parse("Noisia feat. Foreign Beggars - Shellshock")
[f"{a.name} ({a.role})" for a in track.artists]
# ['Noisia (primary)', 'Foreign Beggars (featured)']
parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").versions[0]
# Version(type='live', ..., descriptor='at Wembley', year=1986, ...)
use trackparse::parse;
let track = parse("Noisia feat. Foreign Beggars - Shellshock");
track.artists.iter().map(|a| format!("{} ({})", a.name, a.role)).collect::<Vec<_>>();
// ["Noisia (primary)", "Foreign Beggars (featured)"]
parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").versions.first();
// Some(Version { version_type: Live, descriptor: Some("at Wembley"), year: Some(1986), .. })
import (
"fmt"
"github.com/4matic/trackparse/go"
)
track := trackparse.Parse("Noisia feat. Foreign Beggars - Shellshock")
for _, a := range track.Artists {
fmt.Printf("%s (%s)\n", a.Name, a.Role)
}
// Noisia (primary)
// Foreign Beggars (featured)
v := trackparse.Parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").Versions[0]
fmt.Println(v.Type, *v.Descriptor, *v.Year)
// live at Wembley 1986
#include <stdio.h>
#include <trackparse.h>
trackparse_track *track =
trackparse_parse("Noisia feat. Foreign Beggars - Shellshock", TRACKPARSE_NUL_TERMINATED);
for (size_t i = 0; i < track->artists_count; i++) {
const trackparse_artist *a = &track->artists[i];
printf("%s (%s)\n", a->name.ptr, trackparse_role_name(a->role));
}
// Noisia (primary)
// Foreign Beggars (featured)
trackparse_track_free(track);
track = trackparse_parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)",
TRACKPARSE_NUL_TERMINATED);
const trackparse_version *v = &track->versions[0];
printf("%s %s %d\n", v->type_name.ptr, v->descriptor->ptr, *v->year);
// live at Wembley 1986
trackparse_track_free(track);

Where to next

Section titled “Where to next”
Getting startedInstall it for JavaScript, Python, Rust, Go or C and parse your first track.
What it understandsA tour of real inputs and what comes out.
TracklistsParse, check and edit the tracklist of a mix.
PortsHow the JavaScript, Python, Rust, Go and C packages are kept identical.
Compared to othersWhat other title parsers do with the same inputs.
The specRules R0 to R13, the contract every port follows.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.