pub async fn download_album(
db: State<'_, DatabaseWrapper>,
repository: State<'_, RepositoryManagerWrapper>,
download_manager: State<'_, DownloadManagerWrapper>,
app: AppHandle,
handle: String,
album_id: String,
user_id: String,
base_path: String,
) -> Result<Vec<i64>, String>Expand description
Queue an entire album for download.
Owns the whole operation: the album’s track list comes from the server (the only place that knows all of it), every track is queued and linked to its album, each row’s stream URL is resolved here, and the queue is pumped.
The frontend used to do the second half — resolve one URL per track and pair it with the returned ids by position. That pairing had no basis: the ids came back in the backend’s own order over a different set of rows, so whenever the two lists disagreed a row was handed another track’s URL, and any track past the end of the shorter list was never started at all. Nothing crosses the boundary now except the album id.
TRACES: UR-018, UR-055 | DR-173 | UT-170