feat(mime_app): include video players for audio mime types

This commit is contained in:
Michael Aaron Murphy 2026-06-11 17:15:37 +02:00
parent 3cd0d0c00a
commit 256a6cba19
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -254,7 +254,6 @@ impl MimeAppCache {
pub fn get_apps_for_mime(&self, mime_type: &Mime) -> Vec<(&Arc<MimeApp>, MimeAppMatch)> { pub fn get_apps_for_mime(&self, mime_type: &Mime) -> Vec<(&Arc<MimeApp>, MimeAppMatch)> {
let mut results = Vec::new(); let mut results = Vec::new();
let mut dedupe = FxHashSet::default(); let mut dedupe = FxHashSet::default();
// start with exact matches // start with exact matches
@ -265,6 +264,20 @@ impl MimeAppCache {
.map(|mime_app| (mime_app, MimeAppMatch::Exact)), .map(|mime_app| (mime_app, MimeAppMatch::Exact)),
); );
let include_mime = match mime_type.type_().as_str() {
"audio" => Some("video/mp4".parse::<Mime>().expect("video/mp4 mime")),
_ => None,
};
if let Some(mime) = include_mime {
results.extend(
self.get(&mime)
.iter()
.filter(|&mime_app| dedupe.insert(&mime_app.id))
.map(|mime_app| (mime_app, MimeAppMatch::Exact)),
);
}
// grab matches based off of subclass / parent mime type // grab matches based off of subclass / parent mime type
if let Some(parent_types) = crate::mime_icon::parent_mime_types(mime_type) { if let Some(parent_types) = crate::mime_icon::parent_mime_types(mime_type) {
for parent_type in parent_types { for parent_type in parent_types {