Skip to content

python: v0.4.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 23:42
6a0a4e9

Tracklists pasted from Discord, Reddit, Telegram or YouTube comments often keep their list bullets and Markdown, and DJ sets mark a track played over the previous one with w/. 0.3 read none of that: the time was lost and the decoration ended up in artist names. 0.4.0 reads through it, in both packages.

import { applyEdits, parseTracklist } from "trackparse/tracklist";

const text = [
  "* 00:00 Noisia - Stigma",
  "**[**03:30**] Phace - Psycho**",
  "w/ Mefjus - Sleepless (Acapella)",
  "[07:10] **Imanu** - _Sacrifice_",
].join("\n");

const list = parseTracklist(text);
list.entries.map((e) => [e.time?.seconds ?? null, e.layered, e.track.artists[0].name, e.track.title]);
// [ [ 0, false, 'Noisia', 'Stigma' ],
//   [ 210, false, 'Phace', 'Psycho' ],
//   [ null, true, 'Mefjus', 'Sleepless' ],
//   [ 430, false, 'Imanu', 'Sacrifice' ] ]
list.entries[1].parts;  // { lead: '**[**', time: '03:30', gap: '**] ', rest: 'Phace - Psycho**' }
list.warnings;          // []

applyEdits(text, [{ op: "shift", seconds: 15, from: 2 }]).text.split("\n")[1];
// '**[**03:45**] Phace - Psycho**'

What's new

  • List bullets before a time. * 14:21 Artist - Title, - [01:02] Artist - Title and • 1:02:03 - … keep their time. The bullet goes into lead.
  • Markdown emphasis. **bold**, __underline__, *italic* and _italic_ around the time, a name, a title or the whole line are read through. Nothing is removed from raw or parts: emphasis next to the time sits in lead and gap (so edits keep it), and the parser reads the rest of the line without it.
    • Next to the time, a run of one or two * or _ counts by its position, with or without a partner. Anywhere else, a * or _ only counts when it has a partner on the line and its outer side is a space, a bracket, another * or _, or the line's end, so P*nk, *NSYNC, DJ_Name, Noisia_-_Stigma and a censored F**k stay as written. Backticks, ~~ and || are never Markdown.
    • **Intro** is now a marker and **Part 2:** a header.
  • Layered w/ lines. A line whose track text (after any time or bullet) starts with w/ and whitespace is a track played over the previous one: the entry has layered: true, and the w/ no longer ends up in the first artist's name. An untimed layered line doesn't warn time-missing, and it doesn't break bare track numbering.

Upgrading

  • Every tracklist entry has a new key, layered (boolean). Code that checks the exact set of keys, or a schema copied from an older version, needs it added.
  • Plain lines, without bullets, Markdown or w/, parse the same as in 0.3. On the private corpus of 5,031 real podcast tracklist lines, the output is identical to 0.3.3 apart from layered: false.
  • parse() for single tracks is unchanged in every mode.
  • trackparse/tracklist now adds about 8.3 KiB gzipped (was 7.6 KiB); the CI budget is 9 KiB.

Changelog

0.4.0 (2026-11-10)

Features

  • spec: accept a list bullet before a tracklist time (e926348)
  • spec: layered "w/" lines in tracklists (7fbb7f1)
  • spec: read Markdown emphasis in tracklists (888bc9e)

Bug Fixes

  • spec: pair Markdown emphasis only inside rest (942d5a9)

Documentation

  • describe emphasis next to the time and layered lines as the spec does (d5c0c6c)
  • update the fixture and test counts and the tracklist bundle size (a581eca)

Install (Python)

pip install trackparse==0.4.0

PyPI: https://pypi.org/project/trackparse/0.4.0/ · implements spec 0.4.0 (SPEC.md)