mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01:00
update Beets
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user