From 5e084b7186e3dab883bf7e7c6070303f79097bd0 Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Fri, 20 Apr 2018 07:39:12 +0200 Subject: [PATCH] Fix exception handling and add docs to the toc. --- beetsplug/sonosupdate.py | 12 ++---------- docs/changelog.rst | 3 +++ docs/plugins/index.rst | 4 +++- docs/plugins/sonosupdate.rst | 5 ----- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/beetsplug/sonosupdate.py b/beetsplug/sonosupdate.py index 498ae9835..622604acf 100644 --- a/beetsplug/sonosupdate.py +++ b/beetsplug/sonosupdate.py @@ -15,17 +15,9 @@ """Updates a Sonos library whenever the beets library is changed. This is based on the Kodi Update plugin. - -Put something like the following in your config.yaml to configure: - kodi: - host: localhost - port: 8080 - user: user - pwd: secret """ from __future__ import division, absolute_import, print_function -from beets import config from beets.plugins import BeetsPlugin import six import soco @@ -51,8 +43,8 @@ class SonosUpdate(BeetsPlugin): device = soco.discovery.any_soco() device.music_library.start_library_update() - except: - self._log.warning(u'Sonos update failed') + except NoneType: + self._log.warning(u'Could not find a Sonos device.') return self._log.info(u'Sonos update triggered') diff --git a/docs/changelog.rst b/docs/changelog.rst index 4381edeeb..a923bfe37 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,9 @@ New features: recording skipped directories to the incremental list, so you can revisit them later. Thanks to :user:`sekjun9878`. :bug:`2773` +* A new interoperability plugin to automatically notify Sonos controllers to + update the music library once the beets library got updated. + Thanks to :user:`cgtobi`. Fixes: diff --git a/docs/plugins/index.rst b/docs/plugins/index.rst index e37a270fa..e08a1767f 100644 --- a/docs/plugins/index.rst +++ b/docs/plugins/index.rst @@ -158,6 +158,8 @@ Interoperability * :doc:`plexupdate`: Automatically notifies `Plex`_ whenever the beets library changes. * :doc:`smartplaylist`: Generate smart playlists based on beets queries. +* :doc:`sonosupdate`: Automatically notifies `Sonos`_ whenever the beets library + changes. * :doc:`thumbnails`: Get thumbnails with the cover art on your album folders. * :doc:`badfiles`: Check audio file integrity. @@ -165,6 +167,7 @@ Interoperability .. _Emby: http://emby.media .. _Plex: http://plex.tv .. _Kodi: http://kodi.tv +.. _Sonos: http://sonos.com Miscellaneous ------------- @@ -262,4 +265,3 @@ Here are a few of the plugins written by the beets community: .. _whatlastgenre: https://github.com/YetAnotherNerd/whatlastgenre/tree/master/plugin/beets .. _beets-usertag: https://github.com/igordertigor/beets-usertag .. _beets-popularity: https://github.com/abba23/beets-popularity - diff --git a/docs/plugins/sonosupdate.rst b/docs/plugins/sonosupdate.rst index 1ecf91b92..5a7a6583b 100644 --- a/docs/plugins/sonosupdate.rst +++ b/docs/plugins/sonosupdate.rst @@ -16,8 +16,3 @@ controller every time you change your beets library. .. Sonos: http://sonos.com/ .. _soco: http://python-soco.com - -Configuration -------------- - -There is nothing to configure.