author | Jordan Doyle <jordan@doyle.la> | 2020-02-23 21:13:24.0 +00:00:00 |
---|---|---|
committer | Jordan Doyle <jordan@doyle.la> | 2020-02-23 21:13:24.0 +00:00:00 |
commit | 9c77ab0467ea039d482e909880fe9e9b44a83635 [patch] |
|
tree | 868ce5c1b237c9cf7fe2df1c996bd92c0b4c50c8 |
|
parent | 70cffea2ce60547f2e027e4a0f960a5d3c142cb1 |
|
download | 9c77ab0467ea039d482e909880fe9e9b44a83635.tar.gz |
Provide a way for Speakers to group with a master
Diff
src/device.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/device.rs b/src/device.rs index 40a488d..c1a128c 100644 --- a/src/device.rs +++ a/src/device.rs @@ -397,11 +397,32 @@ }) } /// Groups this Speaker with the given master. /// /// This speaker will be synchronised with the master. pub async fn group(&self, master: &Speaker) -> Result<(), Error> { self.play_track(&format!("x-rincon:{}", master.uuid)).await } /// Ungroups this Speaker from any master it might've had. pub async fn ungroup(&self) -> Result<(), Error> { self.soap( "MediaRenderer/AVTransport/Control", "urn:schemas-upnp-org:service:AVTransport:1", "BecomeCoordinatorOfStandaloneGroup", "<InstanceID>0</InstanceID>", true, ).await?; Ok(()) } /// Grab this Speaker's queue to manipulate. pub fn queue(&self) -> Queue { Queue::for_speaker(self) } /// Get information about the current track /// Get information about what's currently playing on this Speaker. pub async fn track(&self) -> Result<Track, Error> { let resp = self.soap( "MediaRenderer/AVTransport/Control", @@ -458,6 +479,7 @@ } } /// An item in the queue. pub struct QueueItem { pub position: u64, pub uri: String, @@ -468,6 +490,8 @@ pub duration: Duration, } /// Provides some methods for manipulating the queue of the /// [Speaker] that spawned this [Queue]. pub struct Queue<'a> { speaker: &'a Speaker, }