diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index cb47a8cb8..7abc7e319 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -17,6 +17,7 @@ from beets.plugins import BeetsPlugin +from beets.plugins import send as send_event from beets import ui from beets.util import (mkdirall, normpath, sanitize_path, syspath, bytestring_path, path_as_posix, displayable_path) @@ -232,6 +233,8 @@ class SmartPlaylistPlugin(BeetsPlugin): if self.config['urlencode']: path = bytestring_path(pathname2url(path)) f.write(prefix + path + b'\n') + # Send an event when playlists were updated. + send_event("smartplaylist_update") if pretend: self._log.info("Displayed results for {0} playlists", diff --git a/beetsplug/subsonicupdate.py b/beetsplug/subsonicupdate.py index 9480bcb41..4e32f4d30 100644 --- a/beetsplug/subsonicupdate.py +++ b/beetsplug/subsonicupdate.py @@ -53,7 +53,14 @@ class SubsonicUpdate(BeetsPlugin): 'auth': 'token', }) config['subsonic']['pass'].redact = True - self.register_listener('import', self.start_scan) + self.register_listener('database_change', self.db_change) + self.register_listener('smartplaylist_update', self.spl_update) + + def db_change(self, lib, model): + self.register_listener('cli_exit', self.start_scan) + + def spl_update(self): + self.register_listener('cli_exit', self.start_scan) @staticmethod def __create_token():