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.internetlibrary, by setting theconfig.EVENTS_MODULEmodule to point to theevents_twistedmodule. See the example inevents_twisted.Stop the event listener when the last active subscription is unsubscribed.
Raise
SoCoExceptionon an attempt to subscribe a subscription more than once (useSubscription.renew()instead).Allow an optional
strictparameter forSubscription.subscribe(),Subscription.renew()andSubscription.unsubscribe(). If set toFalse, Exceptions will be logged rather than raised. Default:TrueUpon autorenewal, call
Subscription.renew()with thestrictflag 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_failto 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 aSoCoExceptiononSubscription.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_urimethod now accepts title arguments that need XML escaping. (#605)A harmless “Could not handle track info” warning has been removed. (#606)
Let
from_didl_stringthrowDIDLMetadataErrors, allowing them to be caught in the event handling code. (#601)Added support for
object.item.audioItem.audioBook(#618)
Bugfixes
Fix
DidlMusicAlbuminheriting fields fromDidlAudioIteminstead ofDidlAlbum(#592)