Support missing metadata, fixes #56

This commit is contained in:
Jeremy Soller 2025-01-31 16:13:56 -07:00
parent fe143a689f
commit 3466b064e9
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
2 changed files with 15 additions and 4 deletions

View file

@ -4,6 +4,8 @@ no-video-or-audio-file-open = No video or audio file open
open-file = Open file
open-folder = Open folder
subtitles = Subtitles
unknown-author = Unknown Author
untitled = Untitled
# Context Pages

View file

@ -1289,12 +1289,21 @@ impl Application for App {
.content_fit(ContentFit::ScaleDown)
.width(Length::Fill),
);
} else {
col = col.push(widget::icon::from_name("audio-x-generic-symbolic").size(256));
}
col = col.push(widget::vertical_space(space_s));
//TODO: fallback if title missing
col = col.push(widget::text::title4(&self.mpris_meta.title));
for artist in self.mpris_meta.artists.iter() {
col = col.push(widget::text::body(artist));
if self.mpris_meta.title.is_empty() {
col = col.push(widget::text::title4(fl!("untitled")));
} else {
col = col.push(widget::text::title4(&self.mpris_meta.title));
}
if self.mpris_meta.artists.is_empty() {
col = col.push(widget::text::body(fl!("unknown-author")));
} else {
for artist in self.mpris_meta.artists.iter() {
col = col.push(widget::text::body(artist));
}
}
col = col.push(widget::vertical_space(space_s));
if !self.mpris_meta.album.is_empty() {