Compare commits

...
1 Commits
Author SHA1 Message Date
Ansho Rei bce0d68442 feat: show a track's own cover on its album page row
A track whose cover is a different picture from the album's now shows
that cover in its row instead of the track number. Pictures are compared
decoded, since Navidrome gives every track its own cover id even when it
is the album's image. The number column is as wide as the cover, so rows
with and without one line up.
2026-11-04 22:09:32 +01:00
6 changed files with 47 additions and 5 deletions
+6
View File
@@ -2,6 +2,12 @@
One section per version, newest first.
## v0.8.7 (2026-11-04)
### Features
- On an album page, a track whose cover is a different picture from the album's shows its cover instead of its track number. Only servers that give tracks their own art, such as Navidrome, can show this; Nextcloud Music gives every track the album's cover.
## v0.8.6 (2026-11-04)
### Bug fixes
Generated
+1 -1
View File
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "remus"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"anyhow",
"directories",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "remus"
version = "0.8.6"
version = "0.8.7"
edition = "2024"
license = "MIT"
@@ -20,6 +20,7 @@
</supports>
<content_rating type="oars-1.1"/>
<releases>
<release version="0.8.7" date="2026-11-04"/>
<release version="0.8.6" date="2026-11-04"/>
<release version="0.8.5" date="2026-11-04"/>
<release version="0.8.4" date="2026-11-04"/>
+35 -2
View File
@@ -1664,6 +1664,33 @@ impl App {
self.items_range = (lo, hi);
}
/// The album's cover id, on an album page.
fn album_cover_id(&self) -> Option<String> {
let page = self.current_page()?;
if !page.list || !matches!(page.source, Source::Album(_)) {
return None;
}
page.header.as_ref()?.cover.clone()
}
/// Whether a track's cover is a different picture from its album's, so its
/// row shows the cover instead of the track number. Compared by picture:
/// Navidrome gives every track its own cover id even when it is the album's
/// image. False until both are decoded at this size; the load of either
/// redraws the row.
fn own_picture(&mut self, track: Option<&str>, album: &str, px: u32) -> bool {
let Some(track) = track.filter(|t| *t != album) else {
return false;
};
// Starts the album cover's load at row size, which the header does not.
self.cover(album, px);
let print = |app: &mut App, id: &str| app.covers.prints.get(&(id.to_string(), px)).copied();
match (print(self, track), print(self, album)) {
(Some(t), Some(a)) => t != a,
_ => false,
}
}
fn playing_id(&self) -> Option<&str> {
self.current.and_then(|i| self.queue.get(i)).map(|s| s.id.as_str())
}
@@ -1675,7 +1702,11 @@ impl App {
Target::Song(i) => page.songs.get(i).map(|s| s.id.as_str()) == self.playing_id(),
_ => false,
};
let album_cover = self.album_cover_id();
let cover = entry.cover.as_deref().and_then(|id| self.cover(id, px));
let show_art = entry.show_art
|| matches!(entry.target, Target::Song(_))
&& album_cover.is_some_and(|album| self.own_picture(entry.cover.as_deref(), &album, px));
let level = match entry.target {
Target::Setting(Setting::CoverBackdrop) => Some(self.settings.cover_backdrop as f32 / 100.0),
_ => None,
@@ -1691,7 +1722,7 @@ impl App {
has_cover: cover.is_some(),
cover: cover.unwrap_or_default(),
round: entry.round,
show_art: entry.show_art,
show_art,
playing,
slider: level.is_some(),
level: level.unwrap_or_default(),
@@ -1926,9 +1957,11 @@ impl App {
// Refresh whatever shows this cover.
let (lo, hi) = self.items_range;
// Every track row of an album compares its picture with the album's.
let album = self.album_cover_id().as_deref() == Some(id);
let rows: Vec<usize> = match self.current_page() {
Some(p) => (lo..hi.min(p.entries.len()))
.filter(|&i| p.entries[i].cover.as_deref() == Some(id))
.filter(|&i| album || p.entries[i].cover.as_deref() == Some(id))
.collect(),
None => Vec::new(),
};
+3 -1
View File
@@ -213,8 +213,10 @@ component Row inherits Rectangle {
round: root.item.round;
}
}
// As wide as the art, so a row with a cover and a row with a number
// line up, as on an album where some tracks have their own cover.
if !root.item.show-art: Text {
width: 34px * Theme.s;
width: 46px * Theme.s;
text: root.item.playing ? "▶" : root.item.number;
font-size: 15px * Theme.s;
color: root.item.playing ? Theme.highlight : Theme.faint;