mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #1524] [MERGED] fix: add fallback logic for CDN urls #1426
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#1426
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/1524
Author: @lemon-sh
Created: 8/3/2025
Status: ✅ Merged
Merged: 8/8/2025
Merged by: @roderickvd
Base:
dev← Head:cdnurl-fallback📝 Commits (5)
cbd7decfix: add fallback logic for CDN urls1750087mention urls tried count in error, make error type mangling more clear4ea68feupdate changelogdc62125add a 10 second timeout7817b50accept TryInto instead of &str in stream_from_cdn📊 Changes
4 files changed (+81 additions, -25 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
audio/src/fetch/mod.rs(+39 -18)📝
core/src/cdn_url.rs(+29 -0)📝
core/src/spclient.rs(+9 -7)📄 Description
CdnUrlreturn all non-expired URLs instead of just the first one. Then, inAudioFileStreamingall URLs are tried and the first working URL is selected for later use.AudioFileFetch::download_range, but that is also a synchronous function so implementing that would probably require an overhaul of the codebase anyway, unless I'm missing something.stream_from_cdn, as it is not async (it doesn't actually send the request), so I made it accept the singular URL instead ofCdnUrl. It is the responsibility of the caller to implement URL fallback logic by inspecting the result of the streamer.stream_from_cdnanymore, but there are a few ways this could be fixed.SingleCdnUrl?CdnUrlthat would select the working URL and discard the rest?Example log
Closes: #1521
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.