SoCo 0.12 release notes

SoCo 0.12 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

  • New MusicService class for access to all the music services known to Sonos. Note that some of this code is still unstable, and in particular the data structures returned by methods such as get_metadata may change in future. (#262, #358)

  • Add information to the docs about how to put SoCo in the Python path, for test execution (#327, #319)

  • added to_dict() / from_dict() to DidlResource (#330, #318)

  • All tests have been moved from the unittests directory to the tests directory (#336)

  • For developers, more make targets, and a better sdist build (#346)

  • Added discovery.any_soco(), for when you need a SoCo instance, but you don’t care which. This is slightly better than the traditional device = soco.discover().pop() since it will return an existing instance if one is available, without sending discovery packets (#262)

  • Modified DidlObject.to_dict() so that any associated resources list will be also returned as a list of dictionaries instead of returning a list of DidlResource objects. (#340, #338)

  • Added a sonosdump tool in dev_tools, which can print out the various UPnP methods which Sonos uses (#344)

  • Added methods for sonos playlist management: reorder_sonos_playlist, clear_sonos_playlist, move_in_sonos_playlist, remove_from_sonos_playlist, get_sonos_playlist_by_attr (#352, #348, #353) and remove_sonos_playlist (#341, #345)

  • Support playmodes repeat-one (REPEAT_ONE) and shuffle-repeat-one (SHUFFLE_REPEAT_ONE) introduced by Sonos 6.0 (#387)

  • Better discovery: SoCo tries harder to find devices on the local network, particularly where there are multiple network interfaces. The default discovery timeout is also increased to 5 seconds (#395, #432)

  • Large work package on the docs, which contains a new front page, more sections, some advanced topics and an example page (#406, #360, #368, #362, #326, #369).

  • Added optional timeout argument to be passed onto requests when getting speaker info (#302)

  • Ignore .# specified subclasses in Didl xml. Several music services seem to use an out-of-spec way to make sub classes in Didl, by specifying the subclass name or function after a #. This caused our implementation of Didl to reject it. This has now been fixed by simple ignoring these un-official subclasses (#425)

  • Added methods to manipulate sonos sleep functionality: set_sleep_timer, get_sleep_timer (#413)

  • Various cleanups (#351)

  • Extended get_speaker_info to return more information about the Sonos speakers (#335, #320)

Bugfixes

  • Clear zone group cache and reparse zone group information after join and unjoin to prevent giving wrong topology information. (#323, #321)

  • Fix typo preventing SoCo from parsing the audio metadata object used when a TV is playing. (#331)

  • Fix bug where SoCo would raise an exception if music services sent metadata with invalid XML characters (#392, #386)

  • Event lister was (incorrectly) responding to GET and HEAD requests, which could result in local files being served (#430)

  • Minor fix because ordereddict.values in py3 return ValuesView (#359)

  • Fixed bugs with parsing events (#276)

  • Fixed unit tests (#343, #342)

  • Fix in MusicLibrary constructor (#370)

Backwards Compatability

  • Dropped support for Python 3.2 (#324)

  • Methods relating to the music library (get_artists, get_album_artists, get_albums and others) have been moved to the music_library module. Instead of device.get_album_artists(), please now use device.music_library.get_album_artists() etc. Old code will continue to work for the moment, but will raise deprecation warnings (#350)

  • Made a hard deprecation of the Spotify plugin since the API it relied on has been deprecated and it therefore no longer worked (#401, #423)

  • Dropped pylint checks for Python 2.6 (#363)