From 5087bde65b4f5fcc113ca693a0b5dc1de77c3cf8 Mon Sep 17 00:00:00 2001 From: Thang Pham Date: Sun, 1 Dec 2024 15:34:14 -0500 Subject: [PATCH] fix tracks context not playable (#625) --- Cargo.lock | 2 +- spotify_player/Cargo.toml | 2 +- spotify_player/src/event/window.rs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb61828f..c8790fdb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5156,7 +5156,7 @@ dependencies = [ [[package]] name = "spotify_player" -version = "0.20.2" +version = "0.20.3" dependencies = [ "anyhow", "async-trait", diff --git a/spotify_player/Cargo.toml b/spotify_player/Cargo.toml index 04776001..b036ba75 100644 --- a/spotify_player/Cargo.toml +++ b/spotify_player/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spotify_player" -version = "0.20.2" +version = "0.20.3" authors = ["Thang Pham "] edition = "2021" license = "MIT" diff --git a/spotify_player/src/event/window.rs b/spotify_player/src/event/window.rs index 132a56a6..e99f449a 100644 --- a/spotify_player/src/event/window.rs +++ b/spotify_player/src/event/window.rs @@ -304,10 +304,14 @@ fn handle_command_for_track_table_window( filtered_tracks[id].id.uri() }; - let base_playback = if let Some(context_id) = context_id { - Playback::Context(context_id, None) - } else { - Playback::URIs(tracks.iter().map(|t| t.id.clone().into()).collect(), None) + let base_playback = match context_id { + None | Some(ContextId::Tracks(_)) => { + Playback::URIs(tracks.iter().map(|t| t.id.clone().into()).collect(), None) + } + Some(ContextId::Show(_)) => unreachable!( + "show context should be handled by handle_command_for_episode_table_window" + ), + Some(context_id) => Playback::Context(context_id, None), }; client_pub.send(ClientRequest::Player(PlayerRequest::StartPlayback(