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

View file

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

View file

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