From fa8fd0e34d7aa6109c40d2548bc3da60f1a48e2d Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis Date: Fri, 1 Mar 2024 14:59:40 +0100 Subject: [PATCH] Expose more information about queue status Queue item currently playing, loading, preloaded. --- src/cast/proxies.rs | 6 ++++++ src/channels/media.rs | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/cast/proxies.rs b/src/cast/proxies.rs index dd678d766..1a3b0f757 100644 --- a/src/cast/proxies.rs +++ b/src/cast/proxies.rs @@ -321,6 +321,12 @@ pub mod media { pub playback_rate: f32, #[serde(rename = "playerState")] pub player_state: String, + #[serde(rename = "currentItemId")] + pub current_item_id: Option, + #[serde(rename = "loadingItemId")] + pub loading_item_id: Option, + #[serde(rename = "preloadedItemId")] + pub preloaded_item_id: Option, #[serde(rename = "idleReason")] pub idle_reason: Option, #[serde(rename = "extendedStatus")] diff --git a/src/channels/media.rs b/src/channels/media.rs index 0fc866ee6..3d1bcfb07 100644 --- a/src/channels/media.rs +++ b/src/channels/media.rs @@ -662,6 +662,12 @@ pub struct StatusEntry { pub playback_rate: f32, /// Describes the state of the player. pub player_state: PlayerState, + /// Id of the current queue item + pub current_item_id: Option, + /// Id of the item currently loading + pub loading_item_id: Option, + /// Id of the item currently preloaded + pub preloaded_item_id: Option, /// If the player_state is IDLE and the reason it became IDLE is known, this property is /// provided. If the player is IDLE because it just started, this property will not be provided. /// If the player is in any other state this property should not be provided. @@ -696,6 +702,9 @@ impl TryFrom<&proxies::media::Status> for StatusEntry { media: x.media.as_ref().map(TryInto::try_into).transpose()?, playback_rate: x.playback_rate, player_state: PlayerState::from_str(x.player_state.as_ref())?, + current_item_id: x.current_item_id, + loading_item_id: x.loading_item_id, + preloaded_item_id: x.preloaded_item_id, idle_reason: x .idle_reason .as_ref()