Rename "current" to "player"

This commit is contained in:
Sijmen 2023-04-25 18:58:34 +02:00
parent 85e77d34cb
commit dea979074a
Signed by: vijfhoek
GPG Key ID: DAF7821E067D9C48
3 changed files with 8 additions and 4 deletions

View File

@ -50,13 +50,13 @@ async fn get_queue(_req: tide::Request<()>) -> tide::Result {
}
#[derive(Template)]
#[template(path = "current.html")]
#[template(path = "player.html")]
struct CurrentTemplate {
song: Option<mpdrs::Song>,
name: Option<String>,
}
async fn get_current(_req: tide::Request<()>) -> tide::Result {
async fn get_player(_req: tide::Request<()>) -> tide::Result {
let mut mpd = mpd::connect()?;
let song = mpd.currentsong()?;
@ -160,7 +160,7 @@ async fn main() -> tide::Result<()> {
app.at("/").get(index);
app.at("/queue").get(get_queue);
app.at("/current").get(get_current);
app.at("/player").get(get_player);
app.at("/art").get(get_art);
app.at("/sse").get(tide::sse::endpoint(sse));

View File

@ -188,7 +188,7 @@
</div>
<div class="player" hx-ext="sse" sse-connect="/sse">
<div hx-trigger="sse:player" hx-get="/current"></div>
<div hx-trigger="sse:player" hx-get="/player"></div>
<div hx-trigger="sse:playlist,sse:player" hx-get="/queue"></div>
</div>
</body>

View File

@ -13,6 +13,10 @@
<div>{{ artist }}</div>
{% endif %}
</div>
{% else %}
<div class="metadata idle">
Nothing playing right now
</div>
{% endif %}
</div>