feat: play similar tracks from the track menu
"Play similar tracks" in any track's menu asks Yandex for tracks like it (about 20) and plays them as a list, saying how many it found or that there were none. The probe example prints history and similar tracks.
This commit is contained in:
1 parent
b099946fb3
commit
52ad4a2e90
4 files changed
+58
-1
No files matched your search
@@ -166,6 +166,12 @@ impl YmClient {
|
||||
Ok(tracks.into_iter().filter_map(Track::from_yamuse).collect())
|
||||
}
|
||||
|
||||
/// Tracks Yandex considers similar to `track_id` (about 20), best match first.
|
||||
pub async fn similar_tracks(&self, track_id: &str) -> Result<Vec<Track>> {
|
||||
let similar = self.inner.track_similar(track_id).await?;
|
||||
Ok(similar.similar_tracks.into_iter().filter_map(Track::from_yamuse).collect())
|
||||
}
|
||||
|
||||
/// Resolves a signed, short-lived audio URL for a track, at most `max_kbps` when set.
|
||||
pub async fn stream(&self, track_id: &str, max_kbps: Option<u32>) -> Result<Stream> {
|
||||
let variants = self.inner.track_download_info(track_id).await?;
|
||||
|
||||
Reference in new issue
Block a user