trackparse 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/dist/{chunk-3TS4DITR.js → chunk-TOZBVIQ2.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/tracklist.cjs +1 -1
- package/dist/tracklist.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@ Parse music track names into structured metadata: artists, featured artists, rem
|
|
|
7
7
|
[](https://github.com/4matic/trackparse/actions/workflows/js.yml)
|
|
8
8
|
[](https://github.com/4matic/trackparse/blob/main/LICENSE)
|
|
9
9
|
|
|
10
|
+
**[Documentation](https://4matic.github.io/trackparse/)** · **[Playground](https://4matic.github.io/trackparse/playground/)**
|
|
11
|
+
|
|
10
12
|
This is the JavaScript/TypeScript reference implementation of the
|
|
11
13
|
[trackparse spec](https://github.com/4matic/trackparse/blob/main/spec/SPEC.md). It passes all
|
|
12
14
|
12,965 shared fixtures. Zero dependencies, ESM and CommonJS, TypeScript types included, never
|
|
@@ -27,6 +29,8 @@ Node 18 or later. No Node-specific APIs are used, so it also runs in browsers an
|
|
|
27
29
|
|
|
28
30
|
## Quick start
|
|
29
31
|
|
|
32
|
+
**Docs:** [Getting started](https://4matic.github.io/trackparse/start/getting-started/)
|
|
33
|
+
|
|
30
34
|
```js
|
|
31
35
|
import { parse } from "trackparse";
|
|
32
36
|
// const { parse } = require("trackparse");
|
|
@@ -49,12 +53,16 @@ track.mode; // 'youtube' (auto-detected from the junk gro
|
|
|
49
53
|
|
|
50
54
|
## API
|
|
51
55
|
|
|
56
|
+
**Docs:** [parse and ParsedTrack](https://4matic.github.io/trackparse/reference/parse/) · [Other functions](https://4matic.github.io/trackparse/reference/functions/)
|
|
57
|
+
|
|
52
58
|
### `parse(input, options?) → ParsedTrack`
|
|
53
59
|
|
|
54
60
|
Parses one track string. Every key of the result is always present.
|
|
55
61
|
|
|
56
62
|
### `parseArtists(input, options?) → Artist[]`
|
|
57
63
|
|
|
64
|
+
**Docs:** [parseArtists](https://4matic.github.io/trackparse/reference/functions/#parseartistsinput-options)
|
|
65
|
+
|
|
58
66
|
Splits an artist string (no title) into credits.
|
|
59
67
|
|
|
60
68
|
```js
|
|
@@ -69,6 +77,8 @@ parseArtists("Sub Focus, Wilkinson & Dimension feat. Kojo");
|
|
|
69
77
|
|
|
70
78
|
### `format(track, options?) → string`
|
|
71
79
|
|
|
80
|
+
**Docs:** [format](https://4matic.github.io/trackparse/reference/functions/#formattrack-options) · [Formatting](https://4matic.github.io/trackparse/guides/formatting/)
|
|
81
|
+
|
|
72
82
|
Renders a `ParsedTrack` back to `Artists - Title (versions) (prod. ...)`.
|
|
73
83
|
|
|
74
84
|
```js
|
|
@@ -90,6 +100,8 @@ format(t, { feat: "omit", versions: "none" }); // 'Wilkinson - Afterglow'
|
|
|
90
100
|
|
|
91
101
|
### `normalize(input) → string`
|
|
92
102
|
|
|
103
|
+
**Docs:** [normalize](https://4matic.github.io/trackparse/reference/functions/#normalizeinput)
|
|
104
|
+
|
|
93
105
|
The Unicode cleanup applied before parsing: NFC, zero-width spaces, BOM and soft hyphens removed, fullwidth
|
|
94
106
|
brackets, smart quotes and dash variants mapped to ASCII, whitespace collapsed. Idempotent.
|
|
95
107
|
|
|
@@ -100,6 +112,8 @@ normalize(" Artist — Title (Remix) “Quoted” ");
|
|
|
100
112
|
|
|
101
113
|
### `allArtists(track) → Artist[]`
|
|
102
114
|
|
|
115
|
+
**Docs:** [allArtists](https://4matic.github.io/trackparse/reference/functions/#allartiststrack)
|
|
116
|
+
|
|
103
117
|
Track credits plus every version's remixers, deduplicated.
|
|
104
118
|
|
|
105
119
|
```js
|
|
@@ -110,6 +124,8 @@ allArtists(parse("Camo & Krooked - Kallisto (Noisia Remix)", { knownArtists: ["C
|
|
|
110
124
|
|
|
111
125
|
### `createParser(options) → { parse, parseArtists }`
|
|
112
126
|
|
|
127
|
+
**Docs:** [createParser](https://4matic.github.io/trackparse/reference/functions/#createparseroptions)
|
|
128
|
+
|
|
113
129
|
Compiles options, including extra vocabulary, once. Per-call options are merged over the base.
|
|
114
130
|
|
|
115
131
|
```js
|
|
@@ -131,6 +147,8 @@ The spec version this build implements, e.g. `"0.3.0"`. Always equal to the pack
|
|
|
131
147
|
|
|
132
148
|
## Options
|
|
133
149
|
|
|
150
|
+
**Docs:** [Options](https://4matic.github.io/trackparse/reference/options/)
|
|
151
|
+
|
|
134
152
|
| Option | Default | Effect |
|
|
135
153
|
|---|---|---|
|
|
136
154
|
| `mode` | `"auto"` | `"clean"` (tags, store metadata), `"youtube"` (video titles), `"filename"`, `"tracklist"` (one line of a tracklist), or `"auto"` to detect. |
|
|
@@ -197,12 +215,16 @@ interface Version {
|
|
|
197
215
|
`bySplit`, `quotedTitleSplit`, `ambiguousMixCredit`, `unbalancedBrackets`.
|
|
198
216
|
|
|
199
217
|
The full field reference, a gallery of examples and the comparison with other libraries are in the
|
|
200
|
-
[
|
|
218
|
+
[documentation](https://4matic.github.io/trackparse/): [`parse` and ParsedTrack](https://4matic.github.io/trackparse/reference/parse/),
|
|
219
|
+
[options](https://4matic.github.io/trackparse/reference/options/), [warnings](https://4matic.github.io/trackparse/reference/warnings/),
|
|
220
|
+
[what it understands](https://4matic.github.io/trackparse/guides/what-it-understands/). Exact behaviour is defined by the
|
|
201
221
|
[spec](https://github.com/4matic/trackparse/blob/main/spec/SPEC.md) and its
|
|
202
222
|
[fixtures](https://github.com/4matic/trackparse/tree/main/spec/fixtures).
|
|
203
223
|
|
|
204
224
|
## Tracklists
|
|
205
225
|
|
|
226
|
+
**Docs:** [Tracklists](https://4matic.github.io/trackparse/guides/tracklists/) · [Editing tracklists](https://4matic.github.io/trackparse/guides/editing-tracklists/)
|
|
227
|
+
|
|
206
228
|
`trackparse/tracklist` parses a whole tracklist: one entry per line with its kind, start time and
|
|
207
229
|
a full `ParsedTrack`, plus checks with line numbers. Joining `raw + eol` over the entries gives the
|
|
208
230
|
input back byte for byte, whatever the line endings. It's a separate entry point (about 7.6 KiB
|
|
@@ -279,11 +301,13 @@ parse("Electrosoul System - Liquid Metal").title; // 'El
|
|
|
279
301
|
parse("Electrosoul System - Liquid Metal", { mode: "tracklist" }).title; // 'Liquid Metal'
|
|
280
302
|
```
|
|
281
303
|
|
|
282
|
-
Field tables and the full list of rules: [
|
|
283
|
-
and [SPEC R13](https://github.com/4matic/trackparse/blob/main/spec/SPEC.md#r13-tracklists).
|
|
304
|
+
Field tables and the full list of rules: the [tracklists guide](https://4matic.github.io/trackparse/guides/tracklists/), the
|
|
305
|
+
[Tracklist API](https://4matic.github.io/trackparse/reference/tracklist/) and [SPEC R13](https://github.com/4matic/trackparse/blob/main/spec/SPEC.md#r13-tracklists).
|
|
284
306
|
|
|
285
307
|
## Limitations
|
|
286
308
|
|
|
309
|
+
**Docs:** [Limitations and roadmap](https://4matic.github.io/trackparse/project/roadmap/)
|
|
310
|
+
|
|
287
311
|
One track string per `parse()` call; tracklists go through `trackparse/tracklist`, which reads
|
|
288
312
|
start times only (no durations, trailing times or ranges). No label/catalog, key or BPM fields, and
|
|
289
313
|
no built-in artist database: pass `knownArtists` for names that contain a joiner.
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { P as ParsedTrack, A as Artist, F as FormatOptions, a as ParseOptions } from './types-DqJSn18b.cjs';
|
|
2
2
|
export { b as ArtistRole, c as ArtistSource, d as Flags, J as Junk, e as JunkKind, K as KeywordOptions, M as Mode, f as ModeOption, g as Position, T as Timestamp, V as Version, h as VersionDelimiter, i as VersionType, W as Warning } from './types-DqJSn18b.cjs';
|
|
3
3
|
|
|
4
|
-
declare const SPEC_VERSION = "0.3.
|
|
4
|
+
declare const SPEC_VERSION = "0.3.3";
|
|
5
5
|
|
|
6
6
|
declare function format(track: ParsedTrack, options?: FormatOptions): string;
|
|
7
7
|
/** All credited names: track artists plus every version's remixers, deduped by R0.4 key. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { P as ParsedTrack, A as Artist, F as FormatOptions, a as ParseOptions } from './types-DqJSn18b.js';
|
|
2
2
|
export { b as ArtistRole, c as ArtistSource, d as Flags, J as Junk, e as JunkKind, K as KeywordOptions, M as Mode, f as ModeOption, g as Position, T as Timestamp, V as Version, h as VersionDelimiter, i as VersionType, W as Warning } from './types-DqJSn18b.js';
|
|
3
3
|
|
|
4
|
-
declare const SPEC_VERSION = "0.3.
|
|
4
|
+
declare const SPEC_VERSION = "0.3.3";
|
|
5
5
|
|
|
6
6
|
declare function format(track: ParsedTrack, options?: FormatOptions): string;
|
|
7
7
|
/** All credited names: track artists plus every version's remixers, deduped by R0.4 key. */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getDefaultTables, renderVersion, dedupKey, wordMatches } from './chunk-
|
|
2
|
-
export { SPEC_VERSION, createParser, normalize, parse, parseArtists } from './chunk-
|
|
1
|
+
import { getDefaultTables, renderVersion, dedupKey, wordMatches } from './chunk-TOZBVIQ2.js';
|
|
2
|
+
export { SPEC_VERSION, createParser, normalize, parse, parseArtists } from './chunk-TOZBVIQ2.js';
|
|
3
3
|
|
|
4
4
|
// src/format.ts
|
|
5
5
|
function resolve(o) {
|
package/dist/tracklist.cjs
CHANGED
package/dist/tracklist.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { headerWordsData, createListParser, SPEC_VERSION, stringList, PhraseTable, markerWordsData, digitRun, isWhitespace, asciiLower, splitWords, inVocab, isDigit } from './chunk-
|
|
1
|
+
import { headerWordsData, createListParser, SPEC_VERSION, stringList, PhraseTable, markerWordsData, digitRun, isWhitespace, asciiLower, splitWords, inVocab, isDigit } from './chunk-TOZBVIQ2.js';
|
|
2
2
|
|
|
3
3
|
// src/tracklist/split.ts
|
|
4
4
|
function splitLines(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trackparse",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Spec-driven parser for music track strings: artists, feat credits, remixes/versions, junk and more from single track strings (store titles, YouTube titles, filenames) and multi-line tracklists.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Maksim Maksimov",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/4matic/trackparse.git",
|
|
10
10
|
"directory": "js"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.
|
|
12
|
+
"homepage": "https://4matic.github.io/trackparse/",
|
|
13
13
|
"bugs": "https://github.com/4matic/trackparse/issues",
|
|
14
14
|
"keywords": [
|
|
15
15
|
"music",
|