mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-08-05 19:59:51 +00:00
Two related bugs in ServerPlaybackRoutes:
1. _getSourcedTrack looked up the requested media in
audioPlayer.playlist.medias by URI, but MPV issues its HTTP request
before media_kit's Dart-side state has synced with the native
player, so the lookup threw "Bad state: No element" and the proxy
returned 500 ("Failed to open" in MPV). Now resolves the track
directly from playlist.tracks by trackId via firstWhereOrNull,
independent of the player's media list.
2. MPV opens multiple concurrent range requests for the same track
(buffering/seek/reconnect), each opening its own writeOnlyAppend
sink to the same .part cache file; the final rename would then fail
with a file-in-use error (or corrupt the cache from concurrent
appends). Added a _cachingInProgress guard so only one request
caches a given track at a time, cache only full requests
(contentRange.start == 0), write with truncate instead of append,
and clean up the in-progress marker/partial file in finally.
Fixes #3089
|
||
|---|---|---|
| .. | ||
| routes | ||
| active_track_sources.dart | ||
| bonsoir.dart | ||
| pipeline.dart | ||
| router.dart | ||
| server.dart | ||
| sourced_track_provider.dart | ||