Rename "current" to "player"
This commit is contained in:
parent
85e77d34cb
commit
dea979074a
3 changed files with 8 additions and 4 deletions
|
@ -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));
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue