Show track numbers
This commit is contained in:
parent
02f4025de3
commit
f05e17ee3a
3 changed files with 12 additions and 1 deletions
|
@ -25,6 +25,7 @@ pub struct QueueItem {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Entry {
|
pub enum Entry {
|
||||||
Song {
|
Song {
|
||||||
|
track: Option<i32>,
|
||||||
name: String,
|
name: String,
|
||||||
artist: String,
|
artist: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
@ -272,6 +273,7 @@ impl Mpd {
|
||||||
.flat_map(|prop| {
|
.flat_map(|prop| {
|
||||||
if let Some(file) = prop.get("file") {
|
if let Some(file) = prop.get("file") {
|
||||||
Some(Entry::Song {
|
Some(Entry::Song {
|
||||||
|
track: prop.get("Track").and_then(|track| track.parse().ok()),
|
||||||
name: prop.get("Title").unwrap_or(&get_filename(file)).clone(),
|
name: prop.get("Title").unwrap_or(&get_filename(file)).clone(),
|
||||||
artist: prop.get("Artist").unwrap_or(&String::new()).clone(),
|
artist: prop.get("Artist").unwrap_or(&String::new()).clone(),
|
||||||
path: file.to_string(),
|
path: file.to_string(),
|
||||||
|
|
|
@ -225,6 +225,10 @@ ul.dir li .material-symbols-outlined {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.track {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
.player {
|
.player {
|
||||||
width: 25rem;
|
width: 25rem;
|
||||||
padding: 1rem 1rem 0;
|
padding: 1rem 1rem 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<ul class="dir" hx-boost="true" tabindex="-1">
|
<ul class="dir" hx-boost="true" tabindex="-1">
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
{% match entry %}
|
{% match entry %}
|
||||||
{% when mpd::Entry::Song with { name, path, artist } %}
|
{% when mpd::Entry::Song with { track, name, path, artist } %}
|
||||||
<li
|
<li
|
||||||
hx-post="/queue?path={{ path|urlencode }}"
|
hx-post="/queue?path={{ path|urlencode }}"
|
||||||
hx-trigger="click,keyup[key=='Enter']"
|
hx-trigger="click,keyup[key=='Enter']"
|
||||||
|
@ -64,6 +64,11 @@
|
||||||
alt="Album art"
|
alt="Album art"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
{% if let Some(track) = track %}
|
||||||
|
<div class="track">
|
||||||
|
{{ track }}.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="song">
|
<div class="song">
|
||||||
<div class="song__name">{{ name }}</div>
|
<div class="song__name">{{ name }}</div>
|
||||||
<div class="song__artist">{{ artist }}</div>
|
<div class="song__artist">{{ artist }}</div>
|
||||||
|
|
Loading…
Reference in a new issue