From 62a28c7c33e4aef9144e948391c45ccd7b853ffa Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 24 Jun 2026 21:04:04 -0400 Subject: [PATCH] [html] Properly display them --- src/mopidy_smartplaylists/web.py | 7 ++++--- tests/test_web.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mopidy_smartplaylists/web.py b/src/mopidy_smartplaylists/web.py index 55aa228..b21ed5e 100644 --- a/src/mopidy_smartplaylists/web.py +++ b/src/mopidy_smartplaylists/web.py @@ -217,8 +217,9 @@ class RefreshHandler(tornado.web.RequestHandler): class StatusHandler(tornado.web.RequestHandler): - def initialize(self, core: CoreProxy) -> None: + def initialize(self, core: CoreProxy, prefix: str) -> None: self.core = core + self.prefix = prefix def get(self) -> None: try: @@ -233,7 +234,7 @@ class StatusHandler(tornado.web.RequestHandler): }) return result_typed = cast("list[Playlist]", result) - smart = [p for p in result_typed if p.uri and "smartplaylists" in p.uri] + smart = [p for p in result_typed if p.name and p.name.startswith(self.prefix)] self.write( { "smart_playlists": [ @@ -269,5 +270,5 @@ def app_factory(config: Config, core: CoreProxy) -> list[tuple]: (r"/instant-mix", InstantMixHandler, {"core": core, "prefix": prefix, "uris": uris}), (r"/refresh", RefreshHandler, {"core": core, "config": config}), - (r"/status", StatusHandler, {"core": core}), + (r"/status", StatusHandler, {"core": core, "prefix": prefix}), ] diff --git a/tests/test_web.py b/tests/test_web.py index 8f4ef34..83362b7 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -250,7 +250,7 @@ class TestStatusHandler: app = tornado.web.Application( [ - (r"/status", StatusHandler, {"core": core}), + (r"/status", StatusHandler, {"core": core, "prefix": "[Smart]"}), ] ) request = tornado.httputil.HTTPServerRequest( @@ -260,7 +260,7 @@ class TestStatusHandler: connection=mock.Mock(), headers=tornado.httputil.HTTPHeaders(), ) - handler = StatusHandler(app, request, core=core) + handler = StatusHandler(app, request, core=core, prefix="[Smart]") handler.write = mock.Mock() handler.get() data = handler.write.call_args[0][0]