Compare commits
3 commits
f338ab751a
...
f05e17ee3a
Author | SHA1 | Date | |
---|---|---|---|
f05e17ee3a | |||
02f4025de3 | |||
|
b3525c786f |
4 changed files with 14 additions and 3 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1264,9 +1264,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.23"
|
||||
version = "0.37.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
|
||||
checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
|
|
|
@ -25,6 +25,7 @@ pub struct QueueItem {
|
|||
#[derive(Debug)]
|
||||
pub enum Entry {
|
||||
Song {
|
||||
track: Option<i32>,
|
||||
name: String,
|
||||
artist: String,
|
||||
path: String,
|
||||
|
@ -272,6 +273,7 @@ impl Mpd {
|
|||
.flat_map(|prop| {
|
||||
if let Some(file) = prop.get("file") {
|
||||
Some(Entry::Song {
|
||||
track: prop.get("Track").and_then(|track| track.parse().ok()),
|
||||
name: prop.get("Title").unwrap_or(&get_filename(file)).clone(),
|
||||
artist: prop.get("Artist").unwrap_or(&String::new()).clone(),
|
||||
path: file.to_string(),
|
||||
|
|
|
@ -225,6 +225,10 @@ ul.dir li .material-symbols-outlined {
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
.track {
|
||||
margin-right: 0.75rem;
|
||||
}
|
||||
|
||||
.player {
|
||||
width: 25rem;
|
||||
padding: 1rem 1rem 0;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<ul class="dir" hx-boost="true" tabindex="-1">
|
||||
{% for entry in entries %}
|
||||
{% match entry %}
|
||||
{% when mpd::Entry::Song with { name, path, artist } %}
|
||||
{% when mpd::Entry::Song with { track, name, path, artist } %}
|
||||
<li
|
||||
hx-post="/queue?path={{ path|urlencode }}"
|
||||
hx-trigger="click,keyup[key=='Enter']"
|
||||
|
@ -64,6 +64,11 @@
|
|||
alt="Album art"
|
||||
>
|
||||
</div>
|
||||
{% if let Some(track) = track %}
|
||||
<div class="track">
|
||||
{{ track }}.
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="song">
|
||||
<div class="song__name">{{ name }}</div>
|
||||
<div class="song__artist">{{ artist }}</div>
|
||||
|
|
Loading…
Reference in a new issue