pub(crate) fn album_file_names(tracks: &[AlbumTrack]) -> Vec<String>Expand description
Queue one download row per track and link every track to its album.
The linkage is the half that is easy to miss: offline browsing joins a track
to its album on items.album_id (see OfflineRepository::get_items), so a
track whose cached row lacks it stays invisible under the album even after
its file is on disk. Queuing a track is the statement that it belongs to
this album, so the link is written here rather than hoped for from whichever
listing endpoint happened to cache the row.
Idempotent: re-queuing an album fills in what is missing and returns the same row ids, in the order the tracks were given.
A file name per track, unique within the album.
A title is not a unique name inside its own album: a deluxe edition carries the album version and a demo of the same song, and a two-disc set repeats titles across discs. Naming files after the title alone gave those tracks one path, and each download overwrote the previous one — an album that quietly ends up short by however many titles it repeats. The track number disambiguates the ordinary case; anything still colliding falls back to the item id, which is unique by construction.
TRACES: UR-018, UR-055 | DR-173 | UT-172