update Beets

This commit is contained in:
AdeHub
2024-08-24 16:44:41 +12:00
parent a63098a919
commit 046d4d82b4
116 changed files with 17353 additions and 9964 deletions
+8 -7
View File
@@ -16,31 +16,32 @@
This is based on the Kodi Update plugin.
"""
from beets.plugins import BeetsPlugin
import soco
from beets.plugins import BeetsPlugin
class SonosUpdate(BeetsPlugin):
def __init__(self):
super().__init__()
self.register_listener('database_change', self.listen_for_db_change)
self.register_listener("database_change", self.listen_for_db_change)
def listen_for_db_change(self, lib, model):
"""Listens for beets db change and register the update"""
self.register_listener('cli_exit', self.update)
self.register_listener("cli_exit", self.update)
def update(self, lib):
"""When the client exists try to send refresh request to a Sonos
controler.
controller.
"""
self._log.info('Requesting a Sonos library update...')
self._log.info("Requesting a Sonos library update...")
device = soco.discovery.any_soco()
if device:
device.music_library.start_library_update()
else:
self._log.warning('Could not find a Sonos device.')
self._log.warning("Could not find a Sonos device.")
return
self._log.info('Sonos update triggered')
self._log.info("Sonos update triggered")