Skip to content

Commit

Permalink
Expose more information about queue status
Browse files Browse the repository at this point in the history
Queue item currently playing, loading, preloaded.
  • Loading branch information
g2p authored and azasypkin committed May 5, 2024
1 parent c44f6b0 commit fa8fd0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cast/proxies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u16>,
#[serde(rename = "loadingItemId")]
pub loading_item_id: Option<u16>,
#[serde(rename = "preloadedItemId")]
pub preloaded_item_id: Option<u16>,
#[serde(rename = "idleReason")]
pub idle_reason: Option<String>,
#[serde(rename = "extendedStatus")]
Expand Down
9 changes: 9 additions & 0 deletions src/channels/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u16>,
/// Id of the item currently loading
pub loading_item_id: Option<u16>,
/// Id of the item currently preloaded
pub preloaded_item_id: Option<u16>,
/// 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.
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit fa8fd0e

Please sign in to comment.