mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-05 10:49:40 +02:00
Retrieve autoplay contexts over HTTPS and fix repeat/prev/next
Repeat, previous and next used to start playback regardless of the actual playback state. They now start playback only if we were already playing.
This commit is contained in:
parent
6dc7a11b09
commit
bfb7d5689c
4 changed files with 143 additions and 149 deletions
|
@ -616,7 +616,7 @@ impl SpClient {
|
|||
pub async fn get_radio_for_track(&self, track_id: &SpotifyId) -> SpClientResult {
|
||||
let endpoint = format!(
|
||||
"/inspiredby-mix/v2/seed_to_playlist/{}?response-format=json",
|
||||
track_id.to_uri()?
|
||||
track_id.to_base62()?
|
||||
);
|
||||
|
||||
self.request_as_json(&Method::GET, &endpoint, None, None)
|
||||
|
@ -626,13 +626,13 @@ impl SpClient {
|
|||
pub async fn get_apollo_station(
|
||||
&self,
|
||||
context_uri: &str,
|
||||
count: u32,
|
||||
previous_tracks: Vec<&SpotifyId>,
|
||||
count: usize,
|
||||
previous_tracks: Vec<SpotifyId>,
|
||||
autoplay: bool,
|
||||
) -> SpClientResult {
|
||||
let previous_track_str = previous_tracks
|
||||
.iter()
|
||||
.map(|track| track.to_uri())
|
||||
.map(|track| track.to_base62())
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
.join(",");
|
||||
let endpoint = format!(
|
||||
|
@ -644,6 +644,12 @@ impl SpClient {
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn get_next_page(&self, next_page_uri: &str) -> SpClientResult {
|
||||
let endpoint = next_page_uri.trim_start_matches("hm:/");
|
||||
self.request_as_json(&Method::GET, endpoint, None, None)
|
||||
.await
|
||||
}
|
||||
|
||||
// TODO: Find endpoint for newer canvas.proto and upgrade to that.
|
||||
pub async fn get_canvases(&self, request: EntityCanvazRequest) -> SpClientResult {
|
||||
let endpoint = "/canvaz-cache/v0/canvases";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue