[html] Properly display them
Some checks failed
CI / Build (push) Failing after 4m55s
CI / pyright (push) Failing after 5s
CI / pytest (3.13) (push) Failing after 5s
CI / ruff check (push) Failing after 5s
CI / ruff format (push) Failing after 5s
CI / pytest (3.14) (push) Failing after 5s

This commit is contained in:
2026-06-24 21:04:04 -04:00
parent c35e5a4f44
commit 62a28c7c33
2 changed files with 6 additions and 5 deletions

View File

@ -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}),
]

View File

@ -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]