Skip to main content

## collapse_tracks_into_albums

# Function collapse_tracks_into_albums

Source

    fn collapse_tracks_into_albums(items: Vec<MediaItem>) -> Vec<MediaItem>

Expand description

Collapse newly-added tracks into the album they belong to.

`GroupItems=true` asks Jellyfin to do this server-side, but it only groups a track whose parent chain actually resolves a `MusicAlbum`, and older servers ignore the parameter outright — so “Recently Added” still filled up with one card per song of a single import. Grouping again here makes the row’s shape a property of this app rather than of the server it is talking to.

Rules: a track collapses only when it names an `album_id` (without one there is no album to open, so a standalone track stays a track); if the server did return the album row itself, that row wins and its tracks are dropped; the album takes the position of the first of its tracks, so recency order survives. Everything else — movies, episodes, folders — passes through untouched.

TRACES: UR-024, UR-034 | IR-024, JA-016 | UT-241, UT-242, UT-243