diff options
author | metamuffin <metamuffin@disroot.org> | 2023-08-04 09:49:51 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-08-04 09:49:51 +0200 |
commit | cc37287b8c7280051a07d8f735e47e88bfe9fee6 (patch) | |
tree | f6081de54d47e7b4cde709ef77901ac6a6d93327 /remuxer/src/import/mod.rs | |
parent | 9d283fff3352b970a0dd0cb913e122b4d3c3d342 (diff) | |
download | jellything-cc37287b8c7280051a07d8f735e47e88bfe9fee6.tar jellything-cc37287b8c7280051a07d8f735e47e88bfe9fee6.tar.bz2 jellything-cc37287b8c7280051a07d8f735e47e88bfe9fee6.tar.zst |
import video description
Diffstat (limited to 'remuxer/src/import/mod.rs')
-rw-r--r-- | remuxer/src/import/mod.rs | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/remuxer/src/import/mod.rs b/remuxer/src/import/mod.rs index f9f655a..8c89b4d 100644 --- a/remuxer/src/import/mod.rs +++ b/remuxer/src/import/mod.rs @@ -19,6 +19,7 @@ use std::path::PathBuf; pub struct MatroskaMetadata { pub title: Option<String>, pub description: Option<String>, + pub tagline: Option<String>, pub tracks: Vec<SourceTrack>, pub track_sources: Vec<LocalTrack>, pub image: Option<(String, Vec<u8>)>, @@ -87,24 +88,43 @@ fn import_read_segment(segment: &mut Unflatten) -> Result<MatroskaMetadata> { } } MatroskaTag::Tags(_) => { - // let mut children = children.unwrap(); - // while let Some(Ok(Unflat { - // children, item, .. - // })) = children.n() - // { - // match item { - // MatroskaTag::Tag(_) => { - // let mut children = children.unwrap(); - // while let Some(Ok(Unflat { - // children, item, .. - // })) = children.n() { - - // } - - // }, - // _ => debug!("(rst) tag ignored: {item:?}"), - // } - // } + let mut children = children.unwrap(); + while let Some(Ok(Unflat { children, item, .. })) = children.n() { + match item { + MatroskaTag::Tag(_) => { + let mut children = children.unwrap(); + while let Some(Ok(Unflat { children, item, .. })) = children.n() { + match item { + MatroskaTag::SimpleTag(_) => { + let (mut key, mut value) = (None, None); + let mut children = children.unwrap(); + while let Some(Ok(Unflat { + children: _, item, .. + })) = children.n() + { + match item { + MatroskaTag::TagName(k) => key = Some(k), + MatroskaTag::TagString(v) => value = Some(v), + _ => debug!("(rstts) tag ignored: {item:?}"), + } + } + match (key, value) { + (Some(key), Some(value)) => match key.as_str() { + "DESCRIPTION" => m.description = Some(value), + "COMMENT" => m.tagline = Some(value), + _ => debug!("simple tag ignored: {key:?}"), + }, + (None, None) => (), + _ => warn!("simple tag with only one of name/string"), + } + } + _ => debug!("(rstt) tag ignored: {item:?}"), + } + } + } + _ => debug!("(rst) tag ignored: {item:?}"), + } + } } MatroskaTag::Cues(_) => {} MatroskaTag::Chapters(_) => {} |