Filter by mime

This commit is contained in:
2026-03-15 10:20:15 -07:00
parent 8041fc7531
commit 979fbb9b0d
30 changed files with 258 additions and 93 deletions

View File

@@ -9,7 +9,7 @@ use std::{
use tracing::trace;
use crate::{
extract::traits::ObjectExtractor,
extract::traits::{ExtractState, ObjectExtractor},
value::{Item, PileValue, SyncReadBridge},
};
@@ -125,6 +125,7 @@ fn frame_id_to_field(id: &str) -> Cow<'static, str> {
impl ObjectExtractor for Id3Extractor {
async fn field(
&self,
state: &ExtractState,
name: &Label,
args: Option<&str>,
) -> Result<Option<PileValue>, std::io::Error> {
@@ -132,6 +133,10 @@ impl ObjectExtractor for Id3Extractor {
return Ok(None);
}
if !state.ignore_mime && self.item.mime().essence_str() != "audio/mpeg" {
return Ok(None);
}
Ok(self.get_inner().await?.get(name).cloned())
}