Fix edge-case where MPD omits album art format
This commit is contained in:
parent
7286de21bf
commit
bce9855743
4 changed files with 19 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
/.idea
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1668,7 +1668,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mpd_info_screen"
|
name = "mpd_info_screen"
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"freetype",
|
"freetype",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "mpd_info_screen"
|
name = "mpd_info_screen"
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Displays info on currently playing music from an MPD daemon"
|
description = "Displays info on currently playing music from an MPD daemon"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -397,9 +397,22 @@ impl MPDDisplay {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let img_result = ImageReader::with_format(Cursor::new(&image_ref), image_format)
|
let img_result = if is_unknown_format {
|
||||||
.decode()
|
let mut reader = ImageReader::new(Cursor::new(&image_ref));
|
||||||
.map_err(|e| format!("Error: Failed to decode album art image: {}", e));
|
reader = reader
|
||||||
|
.with_guessed_format()
|
||||||
|
.map_err(|e| format!("Error: Failed to guess format of album art image: {}", e))?;
|
||||||
|
reader.decode().map_err(|e| {
|
||||||
|
format!(
|
||||||
|
"Error: Failed to decode album art image (guessed format): {}",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ImageReader::with_format(Cursor::new(&image_ref), image_format)
|
||||||
|
.decode()
|
||||||
|
.map_err(|e| format!("Error: Failed to decode album art image: {}", e))
|
||||||
|
};
|
||||||
if img_result.is_err() && !self.tried_album_art_in_dir {
|
if img_result.is_err() && !self.tried_album_art_in_dir {
|
||||||
return try_second_art_fetch_method(
|
return try_second_art_fetch_method(
|
||||||
&mut self.tried_album_art_in_dir,
|
&mut self.tried_album_art_in_dir,
|
||||||
|
|
Loading…
Reference in a new issue