Compare commits
1
Commits
v0.6.2
...
2e8b2e6a02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e8b2e6a02 |
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
One section per version, newest first.
|
One section per version, newest first.
|
||||||
|
|
||||||
|
## v0.6.3 (2026-11-04)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- On the now-playing screen the cover flips around when the next track has a different picture, and settles with a small bounce. Tracks that share a picture do not flip, even on servers such as Navidrome that give every track its own cover id.
|
||||||
|
|
||||||
## v0.6.2 (2026-11-04)
|
## v0.6.2 (2026-11-04)
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|||||||
Generated
+1
-1
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remus"
|
name = "remus"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"directories",
|
"directories",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "remus"
|
name = "remus"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
</supports>
|
</supports>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="0.6.3" date="2026-11-04"/>
|
||||||
<release version="0.6.2" date="2026-11-04"/>
|
<release version="0.6.2" date="2026-11-04"/>
|
||||||
<release version="0.6.1" date="2026-11-04"/>
|
<release version="0.6.1" date="2026-11-04"/>
|
||||||
<release version="0.6.0" date="2026-11-04"/>
|
<release version="0.6.0" date="2026-11-04"/>
|
||||||
|
|||||||
+148
-11
@@ -128,6 +128,9 @@ enum Setting {
|
|||||||
|
|
||||||
/// How long the UI takes to change from one palette to the next.
|
/// How long the UI takes to change from one palette to the next.
|
||||||
const FADE: Duration = Duration::from_millis(800);
|
const FADE: Duration = Duration::from_millis(800);
|
||||||
|
/// How long the now-playing cover takes to turn edge-on, the `in` animation
|
||||||
|
/// of the `turned` state in NowPlayingView. The turn back is in the .slint.
|
||||||
|
const FLIP_OUT: Duration = Duration::from_millis(170);
|
||||||
|
|
||||||
/// The palette on screen and the one it is fading towards.
|
/// The palette on screen and the one it is fading towards.
|
||||||
struct Fade {
|
struct Fade {
|
||||||
@@ -199,6 +202,8 @@ struct Covers {
|
|||||||
/// Per cover id, whatever size it was decoded at. None for a cover with
|
/// Per cover id, whatever size it was decoded at. None for a cover with
|
||||||
/// too little colour to base a palette on.
|
/// too little colour to base a palette on.
|
||||||
tones: LruCache<String, Option<Tone>>,
|
tones: LruCache<String, Option<Tone>>,
|
||||||
|
/// Hash of each decoded cover's pixels, to tell two ids with one picture.
|
||||||
|
prints: LruCache<CoverKey, u64>,
|
||||||
pending: HashSet<CoverKey>,
|
pending: HashSet<CoverKey>,
|
||||||
failed: HashSet<CoverKey>,
|
failed: HashSet<CoverKey>,
|
||||||
limit: Arc<Semaphore>,
|
limit: Arc<Semaphore>,
|
||||||
@@ -247,6 +252,20 @@ pub struct App {
|
|||||||
icons: RefCell<HashMap<(Prompts, Control), Vec<Image>>>,
|
icons: RefCell<HashMap<(Prompts, Control), Vec<Image>>>,
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
fade: Fade,
|
fade: Fade,
|
||||||
|
/// The now-playing art on screen, `None` when nothing is playing.
|
||||||
|
art_shown: Option<ShownArt>,
|
||||||
|
/// Runs while the cover turns away; the new art goes up when it fires.
|
||||||
|
flip_timer: Timer,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// What the now-playing art shows, to decide whether a track change flips it.
|
||||||
|
/// Compared by picture, not by id: Navidrome gives every track its own cover
|
||||||
|
/// id even when the whole album shares one image.
|
||||||
|
struct ShownArt {
|
||||||
|
/// Cover id of the track the art belongs to.
|
||||||
|
id: Option<String>,
|
||||||
|
/// Hash of the decoded cover, `None` for the letter placeholder.
|
||||||
|
print: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
@@ -282,6 +301,7 @@ impl App {
|
|||||||
covers: Covers {
|
covers: Covers {
|
||||||
images: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
images: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
||||||
tones: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
tones: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
||||||
|
prints: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
||||||
pending: HashSet::new(),
|
pending: HashSet::new(),
|
||||||
failed: HashSet::new(),
|
failed: HashSet::new(),
|
||||||
limit: Arc::new(Semaphore::new(6)),
|
limit: Arc::new(Semaphore::new(6)),
|
||||||
@@ -302,6 +322,8 @@ impl App {
|
|||||||
last_save: Instant::now(),
|
last_save: Instant::now(),
|
||||||
login_focus: 0,
|
login_focus: 0,
|
||||||
toast_timer: Timer::default(),
|
toast_timer: Timer::default(),
|
||||||
|
art_shown: None,
|
||||||
|
flip_timer: Timer::default(),
|
||||||
prompts: Prompts::Keyboard,
|
prompts: Prompts::Keyboard,
|
||||||
icons: RefCell::default(),
|
icons: RefCell::default(),
|
||||||
settings: config::load_settings(),
|
settings: config::load_settings(),
|
||||||
@@ -1449,11 +1471,12 @@ impl App {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cover_loaded(&mut self, key: CoverKey, result: Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>)>) {
|
fn cover_loaded(&mut self, key: CoverKey, result: Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>, u64)>) {
|
||||||
self.covers.pending.remove(&key);
|
self.covers.pending.remove(&key);
|
||||||
match result {
|
match result {
|
||||||
Ok((buf, tone)) => {
|
Ok((buf, tone, print)) => {
|
||||||
self.covers.images.put(key.clone(), Image::from_rgb8(buf));
|
self.covers.images.put(key.clone(), Image::from_rgb8(buf));
|
||||||
|
self.covers.prints.put(key.clone(), print);
|
||||||
// The first size decoded decides: other sizes give a tone that
|
// The first size decoded decides: other sizes give a tone that
|
||||||
// differs in the last digits, which would restart the fade.
|
// differs in the last digits, which would restart the fade.
|
||||||
if !self.covers.tones.contains(&key.0) {
|
if !self.covers.tones.contains(&key.0) {
|
||||||
@@ -1463,7 +1486,16 @@ impl App {
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::debug!("cover {} failed: {e:#}", key.0);
|
log::debug!("cover {} failed: {e:#}", key.0);
|
||||||
|
// The playing track's art may be waiting on this to flip.
|
||||||
|
let playing = self
|
||||||
|
.current
|
||||||
|
.and_then(|i| self.queue.get(i))
|
||||||
|
.and_then(|s| s.cover_art.as_deref())
|
||||||
|
== Some(key.0.as_str());
|
||||||
self.covers.failed.insert(key);
|
self.covers.failed.insert(key);
|
||||||
|
if playing {
|
||||||
|
self.render_player();
|
||||||
|
}
|
||||||
// The playing track's cover failing means the brand palette.
|
// The playing track's cover failing means the brand palette.
|
||||||
self.update_theme();
|
self.update_theme();
|
||||||
return;
|
return;
|
||||||
@@ -1773,18 +1805,16 @@ impl App {
|
|||||||
self.ui.set_np_paused(self.paused);
|
self.ui.set_np_paused(self.paused);
|
||||||
match song {
|
match song {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
let px = self.now_playing_px();
|
self.update_art(&s);
|
||||||
let cover = s.cover_art.as_deref().and_then(|id| self.cover(id, px));
|
self.prefetch_next_cover();
|
||||||
self.ui
|
|
||||||
.set_np_letter(initial(s.album.as_deref().unwrap_or(&s.title)).into());
|
|
||||||
self.ui.set_np_tint(tint(s.album.as_deref().unwrap_or(&s.title)));
|
|
||||||
self.ui.set_np_has_cover(cover.is_some());
|
|
||||||
self.ui.set_np_cover(cover.unwrap_or_default());
|
|
||||||
self.ui.set_np_title(s.title.into());
|
self.ui.set_np_title(s.title.into());
|
||||||
self.ui.set_np_artist(s.artist.unwrap_or_default().into());
|
self.ui.set_np_artist(s.artist.unwrap_or_default().into());
|
||||||
self.ui.set_np_album(s.album.unwrap_or_default().into());
|
self.ui.set_np_album(s.album.unwrap_or_default().into());
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
self.flip_timer.stop();
|
||||||
|
self.ui.set_np_flip_out(false);
|
||||||
|
self.art_shown = None;
|
||||||
self.ui.set_np_has_cover(false);
|
self.ui.set_np_has_cover(false);
|
||||||
self.ui.set_np_cover(Image::default());
|
self.ui.set_np_cover(Image::default());
|
||||||
self.ui.set_np_letter("".into());
|
self.ui.set_np_letter("".into());
|
||||||
@@ -1797,6 +1827,94 @@ impl App {
|
|||||||
self.update_theme();
|
self.update_theme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shows the song's art, flipping the cover if it is a different picture
|
||||||
|
/// from the one on screen. While a changed track's cover loads, the old one
|
||||||
|
/// stays up: the load ends in a render either way, and decides then.
|
||||||
|
fn update_art(&mut self, s: &Song) {
|
||||||
|
if self.flip_timer.running() {
|
||||||
|
// Mid-turn: the midpoint puts up whatever is current then.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let Some(shown) = &self.art_shown else {
|
||||||
|
// From nothing playing: no flip, the cover fades in when it loads.
|
||||||
|
self.render_art(s);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
if shown.id == s.cover_art || self.screen != Screen::NowPlaying {
|
||||||
|
self.render_art(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let Some(print) = self.art_print(s) else { return };
|
||||||
|
if Some(print) == self.art_shown.as_ref().map(|a| a.print) {
|
||||||
|
log::debug!("same cover picture under a new id, no flip");
|
||||||
|
self.render_art(s);
|
||||||
|
} else {
|
||||||
|
log::debug!("cover picture changed, flipping");
|
||||||
|
self.ui.set_np_flip_out(true);
|
||||||
|
self.flip_timer
|
||||||
|
.start(slint::TimerMode::SingleShot, FLIP_OUT, || with_app(|app| app.flip_in()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The picture the song's art will show: `Some(None)` for the placeholder,
|
||||||
|
/// `None` while its cover is still loading.
|
||||||
|
fn art_print(&mut self, s: &Song) -> Option<Option<u64>> {
|
||||||
|
let Some(id) = s.cover_art.as_deref() else {
|
||||||
|
return Some(None);
|
||||||
|
};
|
||||||
|
let key: CoverKey = (id.to_string(), self.now_playing_px());
|
||||||
|
if let Some(p) = self.covers.prints.get(&key) {
|
||||||
|
return Some(Some(*p));
|
||||||
|
}
|
||||||
|
if self.covers.failed.contains(&key) {
|
||||||
|
return Some(None);
|
||||||
|
}
|
||||||
|
// Starts the load if it is not under way.
|
||||||
|
self.cover(id, key.1);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads the next track's cover at the now-playing size, so a skip can
|
||||||
|
/// tell at once whether the picture changes.
|
||||||
|
fn prefetch_next_cover(&mut self) {
|
||||||
|
if self.screen != Screen::NowPlaying {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let next = self.current.and_then(|i| self.queue.get(i + 1));
|
||||||
|
if let Some(id) = next.and_then(|s| s.cover_art.clone()) {
|
||||||
|
let px = self.now_playing_px();
|
||||||
|
self.cover(&id, px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Puts the song's cover, or its letter placeholder, on screen.
|
||||||
|
fn render_art(&mut self, s: &Song) {
|
||||||
|
let px = self.now_playing_px();
|
||||||
|
let cover = s.cover_art.as_deref().and_then(|id| self.cover(id, px));
|
||||||
|
let print = s
|
||||||
|
.cover_art
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|id| self.covers.prints.get(&(id.clone(), px)).copied())
|
||||||
|
.filter(|_| cover.is_some());
|
||||||
|
let name = s.album.as_deref().unwrap_or(&s.title);
|
||||||
|
self.ui.set_np_letter(initial(name).into());
|
||||||
|
self.ui.set_np_tint(tint(name));
|
||||||
|
self.ui.set_np_has_cover(cover.is_some());
|
||||||
|
self.ui.set_np_cover(cover.unwrap_or_default());
|
||||||
|
self.art_shown = Some(ShownArt {
|
||||||
|
id: s.cover_art.clone(),
|
||||||
|
print,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The cover is edge-on: swap in the current track's art and turn it back.
|
||||||
|
fn flip_in(&mut self) {
|
||||||
|
if let Some(s) = self.current.and_then(|i| self.queue.get(i)).cloned() {
|
||||||
|
self.render_art(&s);
|
||||||
|
}
|
||||||
|
self.ui.set_np_flip_out(false);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------- now playing
|
// ---------------------------------------------------------------- now playing
|
||||||
|
|
||||||
fn open_now_playing(&mut self) {
|
fn open_now_playing(&mut self) {
|
||||||
@@ -2033,7 +2151,7 @@ fn bucket(px: f32) -> u32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Decodes a cover at `px` and works out its tone for the album art palette.
|
/// Decodes a cover at `px` and works out its tone for the album art palette.
|
||||||
fn decode_cover(bytes: &[u8], px: u32) -> Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>)> {
|
fn decode_cover(bytes: &[u8], px: u32) -> Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>, u64)> {
|
||||||
let img = image::load_from_memory(bytes)?;
|
let img = image::load_from_memory(bytes)?;
|
||||||
let img = if img.width() > px || img.height() > px {
|
let img = if img.width() > px || img.height() > px {
|
||||||
img.resize(px, px, image::imageops::FilterType::Triangle)
|
img.resize(px, px, image::imageops::FilterType::Triangle)
|
||||||
@@ -2046,8 +2164,11 @@ fn decode_cover(bytes: &[u8], px: u32) -> Result<(SharedPixelBuffer<Rgb8Pixel>,
|
|||||||
.to_rgb8();
|
.to_rgb8();
|
||||||
let tone = crate::palette::tone(small.as_raw());
|
let tone = crate::palette::tone(small.as_raw());
|
||||||
let rgb = img.to_rgb8();
|
let rgb = img.to_rgb8();
|
||||||
|
let mut hasher = std::hash::DefaultHasher::new();
|
||||||
|
std::hash::Hash::hash(rgb.as_raw(), &mut hasher);
|
||||||
|
let print = std::hash::Hasher::finish(&hasher);
|
||||||
let buf = SharedPixelBuffer::clone_from_slice(rgb.as_raw(), rgb.width(), rgb.height());
|
let buf = SharedPixelBuffer::clone_from_slice(rgb.as_raw(), rgb.width(), rgb.height());
|
||||||
Ok((buf, tone))
|
Ok((buf, tone, print))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn color(lab: Lab) -> Color {
|
fn color(lab: Lab) -> Color {
|
||||||
@@ -2156,6 +2277,22 @@ fn join_dot<I: IntoIterator<Item = Option<String>>>(parts: I) -> String {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
fn png(pixel: [u8; 3]) -> Vec<u8> {
|
||||||
|
let img = image::RgbImage::from_pixel(8, 8, image::Rgb(pixel));
|
||||||
|
let mut out = std::io::Cursor::new(Vec::new());
|
||||||
|
img.write_to(&mut out, image::ImageFormat::Png).unwrap();
|
||||||
|
out.into_inner()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn one_picture_under_two_ids_has_one_print() {
|
||||||
|
let (_, _, a) = decode_cover(&png([120, 20, 30]), 64).unwrap();
|
||||||
|
let (_, _, b) = decode_cover(&png([120, 20, 30]), 64).unwrap();
|
||||||
|
let (_, _, c) = decode_cover(&png([20, 120, 30]), 64).unwrap();
|
||||||
|
assert_eq!(a, b);
|
||||||
|
assert_ne!(a, c);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn grid_window_is_row_aligned() {
|
fn grid_window_is_row_aligned() {
|
||||||
assert_eq!(window(1000, 0, 5, false), (0, 55));
|
assert_eq!(window(1000, 0, 5, false), (0, 55));
|
||||||
|
|||||||
+22
-1
@@ -756,6 +756,9 @@ component NowPlayingView inherits Rectangle {
|
|||||||
in property <string> duration;
|
in property <string> duration;
|
||||||
in property <bool> paused;
|
in property <bool> paused;
|
||||||
in property <bool> has-track;
|
in property <bool> has-track;
|
||||||
|
// True while the cover turns away; the app swaps the cover at edge-on and
|
||||||
|
// sets it back to false to turn the new one in.
|
||||||
|
in property <bool> flip-out;
|
||||||
in property <[Item]> queue;
|
in property <[Item]> queue;
|
||||||
in property <int> queue-count;
|
in property <int> queue-count;
|
||||||
in property <int> queue-selected;
|
in property <int> queue-selected;
|
||||||
@@ -786,9 +789,11 @@ component NowPlayingView inherits Rectangle {
|
|||||||
spacing: 10px * Theme.s;
|
spacing: 10px * Theme.s;
|
||||||
width: root.art-size;
|
width: root.art-size;
|
||||||
|
|
||||||
Art {
|
art := Art {
|
||||||
width: root.art-size;
|
width: root.art-size;
|
||||||
height: root.art-size;
|
height: root.art-size;
|
||||||
|
// Set here so the turned state below has a value to return to.
|
||||||
|
transform-scale-x: 100%;
|
||||||
source: root.cover;
|
source: root.cover;
|
||||||
has-image: root.has-cover;
|
has-image: root.has-cover;
|
||||||
tint: root.tint;
|
tint: root.tint;
|
||||||
@@ -873,6 +878,20 @@ component NowPlayingView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A flip around the vertical axis, faked by squashing the width: Slint has
|
||||||
|
// no perspective. The turn back overshoots a little and settles.
|
||||||
|
states [
|
||||||
|
turned when root.flip-out: {
|
||||||
|
art.transform-scale-x: 0%;
|
||||||
|
in {
|
||||||
|
animate art.transform-scale-x { duration: 170ms; easing: ease-in; }
|
||||||
|
}
|
||||||
|
out {
|
||||||
|
animate art.transform-scale-x { duration: 380ms; easing: cubic-bezier(0.34, 1.5, 0.64, 1); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
export component AppWindow inherits Window {
|
export component AppWindow inherits Window {
|
||||||
@@ -936,6 +955,7 @@ export component AppWindow inherits Window {
|
|||||||
in property <string> np-position;
|
in property <string> np-position;
|
||||||
in property <string> np-duration;
|
in property <string> np-duration;
|
||||||
in property <bool> np-paused;
|
in property <bool> np-paused;
|
||||||
|
in property <bool> np-flip-out;
|
||||||
in property <[Item]> queue-items;
|
in property <[Item]> queue-items;
|
||||||
in property <int> queue-count;
|
in property <int> queue-count;
|
||||||
in property <int> queue-selected;
|
in property <int> queue-selected;
|
||||||
@@ -1097,6 +1117,7 @@ export component AppWindow inherits Window {
|
|||||||
duration: root.np-duration;
|
duration: root.np-duration;
|
||||||
paused: root.np-paused;
|
paused: root.np-paused;
|
||||||
has-track: root.np-has-track;
|
has-track: root.np-has-track;
|
||||||
|
flip-out: root.np-flip-out;
|
||||||
queue: root.queue-items;
|
queue: root.queue-items;
|
||||||
queue-count: root.queue-count;
|
queue-count: root.queue-count;
|
||||||
queue-selected: root.queue-selected;
|
queue-selected: root.queue-selected;
|
||||||
|
|||||||
Reference in New Issue
Block a user