soco.snapshot module¶
Functionality to support saving and restoring the current Sonos state.
This is useful for scenarios such as when you want to switch to radio and then back again to what was playing previously.
-
class
soco.snapshot.
Snapshot
(device, snapshot_queue=False)[source]¶ A snapshot of the current state.
Note
This does not change anything to do with the configuration such as which group the speaker is in, just settings that impact what is playing, or how it is played.
List of sources that may be playing using root of media_uri:
x-rincon-queue
: playing from Queuex-sonosapi-stream
: playing a stream (eg radio)x-file-cifs
: playing filex-rincon
: slave zone (only change volume etc. rest from coordinator)Parameters: Warning
It is strongly advised that you do not snapshot the queue unless you really need to as it takes a very long time to restore large queues as it is done one track at a time.
-
snapshot
()[source]¶ Record and store the current state of a device.
Returns: True
if the device is a coordinator,False
otherwise. Useful for determining whether playing an alert on a device will ungroup it.Return type: bool
-
restore
(fade=False)[source]¶ Restore the state of a device to that which was previously saved.
For coordinator devices restore everything. For slave devices only restore volume etc., not transport info (transport info comes from the slave’s coordinator).
Parameters: fade (bool) – Whether volume should be faded up on restore.
-