File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212- [ playback] ` pipe ` : Better error handling
1313
1414### Added
15+ - [ core] ` apresolve ` : Blacklist ap-gew4 access point that causes channel errors
1516- [ playback] ` pipe ` : Implement stop
1617
1718### Fixed
@@ -116,7 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
116117### Fixed
117118- [ connect] Fix step size on volume up/down events
118119- [ connect] Fix looping back to the first track after the last track of an album or playlist
119- - [ playback] Incorrect ` PlayerConfig::default().normalisation_threshold ` caused distortion when using dynamic volume normalisation downstream
120+ - [ playback] Incorrect ` PlayerConfig::default().normalisation_threshold ` caused distortion when using dynamic volume normalisation downstream
120121- [ playback] Fix ` log ` and ` cubic ` volume controls to be mute at zero volume
121122- [ playback] Fix ` S24_3 ` format on big-endian systems
122123- [ playback] ` alsamixer ` : make ` cubic ` consistent between cards that report minimum volume as mute, and cards that report some dB value
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use url::Url;
88
99const APRESOLVE_ENDPOINT : & str = "http://apresolve.spotify.com:80" ;
1010const AP_FALLBACK : & str = "ap.spotify.com:443" ;
11+ const AP_BLACKLIST : [ & str ; 1 ] = [ "ap-gew4.spotify.com" ] ;
1112
1213#[ derive( Clone , Debug , Deserialize ) ]
1314struct ApResolveData {
@@ -42,18 +43,35 @@ async fn try_apresolve(
4243 let body = hyper:: body:: to_bytes ( response. into_body ( ) ) . await ?;
4344 let data: ApResolveData = serde_json:: from_slice ( body. as_ref ( ) ) ?;
4445
46+ // filter APs that are known to cause channel errors
47+ let aps: Vec < String > = data
48+ . ap_list
49+ . into_iter ( )
50+ . filter_map ( |ap| {
51+ let host = ap. parse :: < Uri > ( ) . ok ( ) ?. host ( ) ?. to_owned ( ) ;
52+ if !AP_BLACKLIST . iter ( ) . any ( |& blacklisted| host == blacklisted) {
53+ Some ( ap)
54+ } else {
55+ warn ! ( "Ignoring blacklisted access point {}" , ap) ;
56+ None
57+ }
58+ } )
59+ . collect ( ) ;
60+
4561 let ap = if ap_port. is_some ( ) || proxy. is_some ( ) {
46- data. ap_list . into_iter ( ) . find_map ( |ap| {
62+ // filter on ports if specified on the command line...
63+ aps. into_iter ( ) . find_map ( |ap| {
4764 if ap. parse :: < Uri > ( ) . ok ( ) ?. port ( ) ? == port {
4865 Some ( ap)
4966 } else {
5067 None
5168 }
5269 } )
5370 } else {
54- data. ap_list . into_iter ( ) . next ( )
71+ // ...or pick the first on the list
72+ aps. into_iter ( ) . next ( )
5573 }
56- . ok_or ( "empty AP List " ) ?;
74+ . ok_or ( "Unable to resolve any viable access points. " ) ?;
5775
5876 Ok ( ap)
5977}
You can’t perform that action at this time.
0 commit comments