also add attribute labels on id3 extraction
parent
4f36bff549
commit
1aa779e816
|
@ -2,6 +2,7 @@ use super::Extractor;
|
|||
use crate::{
|
||||
addressing::Address,
|
||||
database::{
|
||||
constants,
|
||||
entry::{Entry, EntryValue},
|
||||
UpEndConnection,
|
||||
},
|
||||
|
@ -58,16 +59,23 @@ impl Extractor for ID3Extractor {
|
|||
|
||||
let result: Vec<Entry> = tags
|
||||
.frames()
|
||||
.filter_map(|frame| match frame.content() {
|
||||
id3::Content::Text(text) => Some(Entry {
|
||||
entity: address.clone(),
|
||||
attribute: format!("ID3_{}", frame.id()),
|
||||
value: match frame.id() {
|
||||
"TYER" | "TBPM" => EntryValue::guess_from(text),
|
||||
_ => text.clone().into(),
|
||||
.flat_map(|frame| match frame.content() {
|
||||
id3::Content::Text(text) => vec![
|
||||
Entry {
|
||||
entity: address.clone(),
|
||||
attribute: format!("ID3_{}", frame.id()),
|
||||
value: match frame.id() {
|
||||
"TYER" | "TBPM" => EntryValue::guess_from(text),
|
||||
_ => text.clone().into(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
_ => None,
|
||||
Entry {
|
||||
entity: Address::Attribute(format!("ID3_{}", frame.id())),
|
||||
attribute: constants::LABEL_ATTR.into(),
|
||||
value: format!("ID3: {}", frame.name()).into(),
|
||||
},
|
||||
],
|
||||
_ => vec![],
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
Loading…
Reference in New Issue