Track number is parsed from the first ' - ' in the filename #5

Closed
opened 2026-08-02 14:27:21 +02:00 by Claude · 1 comment
Collaborator

track_node (crates/jellyfin-app/src/scan/tree.rs:376) takes
stem.split_once(" - ") and parses the first segment as the index. Real
filenames put the artist there:

AES Dana - (a) period. - 01 - Period 01 _ Foreword.mp3
^^^^^^^^ parsed as the track number

1 of our 2 340 audio rows has an IndexNumber; upstream reads the track
tag and has 4 452. Without it tracks cannot sort into album order.

Reading the tag would make this fallback mostly moot, but the fallback is still
wrong for any library without tags.


Found by scanning /mnt/media (285 movies, 289 shows, 74 music artists —
~13 000 media files on a CIFS mount) with both this server and upstream
Jellyfin at the pinned commit, remote metadata and image fetchers disabled on
upstream so both were reading files only. Upstream was given the same mount
path so MD5(UTF-16LE(path)) agrees and rows compare directly.

`track_node` (`crates/jellyfin-app/src/scan/tree.rs:376`) takes `stem.split_once(" - ")` and parses the first segment as the index. Real filenames put the artist there: AES Dana - (a) period. - 01 - Period 01 _ Foreword.mp3 ^^^^^^^^ parsed as the track number **1** of our 2 340 audio rows has an `IndexNumber`; upstream reads the `track` tag and has 4 452. Without it tracks cannot sort into album order. Reading the tag would make this fallback mostly moot, but the fallback is still wrong for any library without tags. --- Found by scanning `/mnt/media` (285 movies, 289 shows, 74 music artists — ~13 000 media files on a CIFS mount) with both this server and upstream Jellyfin at the pinned commit, remote metadata and image fetchers disabled on upstream so both were reading files only. Upstream was given the same mount path so `MD5(UTF-16LE(path))` agrees and rows compare directly.
Author
Collaborator

Fixed in 5c17bf8 and 1c301b5.

Upstream never reads a track's number off its filename — only the track tag
gives one, and 437 of this library's tracks have none at all. The decisive case
is 12 - Daft Punk - Elhea.mp3, which upstream stored as IndexNumber = 0: no
reader of that filename could produce it.

So the resolution now numbers nothing and names a track after its whole file,
and the probe fills both. The same " - " split had been taking the name apart
as well, where upstream keeps the stem until a title tag replaces it.

Review found the sort name had been wrong for as long as it existed: a track
sorted by number and name where upstream puts the disc in front of both
(3530 tracks here carry one), and an unnumbered track sorted by a normalised
name where upstream leaves it exactly as written (437 tracks).

Every column of a probed track is now diffed against upstream's snapshot rather
than the tag columns alone.

Fixed in `5c17bf8` and `1c301b5`. Upstream never reads a track's number off its filename — only the `track` tag gives one, and 437 of this library's tracks have none at all. The decisive case is `12 - Daft Punk - Elhea.mp3`, which upstream stored as `IndexNumber = 0`: no reader of that filename could produce it. So the resolution now numbers nothing and names a track after its whole file, and the probe fills both. The same `" - "` split had been taking the name apart as well, where upstream keeps the stem until a `title` tag replaces it. Review found the sort name had been wrong for as long as it existed: a track sorted by number and name where upstream puts the **disc** in front of both (3530 tracks here carry one), and an unnumbered track sorted by a normalised name where upstream leaves it exactly as written (437 tracks). Every column of a probed track is now diffed against upstream's snapshot rather than the tag columns alone.
Sign in to join this conversation.
No description provided.