GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing 4matic.github.io — A parser for track names and tracklists Messy track names in. |
| Split on the dash | trackparse | |
|---|---|---|
| Artist | Wilkinson ft. Becky Hill & Tom Cane | Wilkinson |
| Featured | lost | Becky Hill, Tom Cane |
| Title | Afterglow (Sub Focus VIP Remix) [Official Video] | Afterglow |
| Version | lost | remix + vip, by Sub Focus |
| Noise | lost | |
| Position | lost | 1 |
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.
Remix, VIP, bootleg, extended, radio edit, live, remaster, sped up, slowed and the rest, each with its remixers, modifiers and year.
[Official Video], [HD], - YouTube and [NCS Release] leave the title but land in junk with a kind, instead of disappearing.
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.
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.
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.
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 1986trackparse_track_free(track);