[html] Properly display them
Some checks failed
Some checks failed
This commit is contained in:
@ -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}),
|
||||
]
|
||||
|
||||
@ -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]
|
||||
|
||||
Reference in New Issue
Block a user