SoCo 0.16 release notes
SoCo 0.16 is a new version of the SoCo library. This release adds new features and fixes several bugs.
SoCo (Sonos Controller) is a simple Python class that allows you to programmatically control Sonos speakers.
New Features and Improvements
Make events server configurable (#602)
Allow the user a choice in how the event listener is implemented. The default is for the event listener to use the requests library and run in a thread. This update allows the user to run the event listener using the
twisted.internet
library, by setting theconfig.EVENTS_MODULE
module to point to theevents_twisted
module. See the example inevents_twisted
.Stop the event listener when the last active subscription is unsubscribed.
Raise
SoCoException
on an attempt to subscribe a subscription more than once (useSubscription.renew()
instead).Allow an optional
strict
parameter forSubscription.subscribe()
,Subscription.renew()
andSubscription.unsubscribe()
. If set toFalse
, Exceptions will be logged rather than raised. Default:True
Upon autorenewal, call
Subscription.renew()
with thestrict
flag set toFalse
, so that any Exception is logged, not raised. This is because there is no calling code to catch an Exception.Provide for calling code to set
Subscription.auto_renew_fail
to refer to a callback function. If an Exception occurs upon autorenewal, this callback will be called with the Exception as the sole parameter.If an Exception occurs upon
Subscription.subscribe()
orSubscription.renew()
, cancel the subscription, unless the Exception was aSoCoException
onSubscription.subscribe()
. For example, if an Exception occurs because the network went down, the subscription will be cancelled.Use a threading lock with
Subscription.subscribe()
,Subscription.renew()
andSubscription.unsubscribe()
, because autorenewal occurs from a thread.
Allow the user to configure the event listener IP address that is sent to the Sonos speakers. The default is to auto detect, but it can now be overridden. This allows for more complex network configurations (e.g. using Docker containers) to be supported. (#604)
The
play_uri
method now accepts title arguments that need XML escaping. (#605)A harmless “Could not handle track info” warning has been removed. (#606)
Let
from_didl_string
throwDIDLMetadataErrors
, allowing them to be caught in the event handling code. (#601)Added support for
object.item.audioItem.audioBook
(#618)
Bugfixes
Fix
DidlMusicAlbum
inheriting fields fromDidlAudioItem
instead ofDidlAlbum
(#592)