feat(mime_app): include video players for audio mime types
This commit is contained in:
parent
3cd0d0c00a
commit
256a6cba19
1 changed files with 14 additions and 1 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue