jpeg quality, sooner drop
This commit is contained in:
parent
9935a502ac
commit
473c7ef7e5
3 changed files with 11 additions and 9 deletions
|
@ -81,4 +81,3 @@ panic = "abort"
|
|||
|
||||
[profile.bench]
|
||||
debug = true
|
||||
panic = "abort"
|
||||
|
|
|
@ -159,6 +159,13 @@ impl Player {
|
|||
let mpris_art_path = audrey::globals::MPRIS_ART_PATH.lock().await;
|
||||
|
||||
if let Some(song) = self.window().song() {
|
||||
if let Some(path) = mpris_art_path.as_ref() {
|
||||
map.insert(
|
||||
"mpris:artUrl",
|
||||
(url::Url::from_file_path(path).unwrap().to_string()).into(),
|
||||
);
|
||||
}
|
||||
drop(mpris_art_path);
|
||||
map.insert(
|
||||
"mpris:trackid",
|
||||
format!("/eu/callcc/audrey/Track/{}", song.counter()).into(),
|
||||
|
@ -167,13 +174,6 @@ impl Player {
|
|||
"mpris:length",
|
||||
((self.window().duration() * MICROSECONDS) as i64).into(),
|
||||
);
|
||||
if let Some(path) = mpris_art_path.as_ref() {
|
||||
map.insert(
|
||||
"mpris:artUrl",
|
||||
(url::Url::from_file_path(path).unwrap().to_string()).into(),
|
||||
);
|
||||
}
|
||||
drop(mpris_art_path);
|
||||
map.insert("xesam:album", song.album().into());
|
||||
// TODO: use the right opensubsonic data
|
||||
map.insert("xesam:artist", vec![song.artist()].into());
|
||||
|
|
|
@ -780,7 +780,10 @@ mod imp {
|
|||
image_copy.resize(400, 400, image::imageops::FilterType::Lanczos3);
|
||||
// resize reoutputs rgba image; we can't save an rgba jpeg
|
||||
let resized = image::DynamicImage::ImageRgb8(resized.into());
|
||||
resized.save_with_format(&save_path_copy, image::ImageFormat::Jpeg)?;
|
||||
let writer = std::fs::File::create(&save_path_copy)?;
|
||||
let encoder =
|
||||
image::codecs::jpeg::JpegEncoder::new_with_quality(&writer, 95);
|
||||
resized.write_with_encoder(encoder)?;
|
||||
*mpris_art_path = Some(save_path_copy);
|
||||
Ok(())
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue