pub fn parse_path(input: &str, options: Options) -> Vec<Element>Expand description
Parse a single filename that may carry a directory prefix, so the result describes the file rather than the folder.
parse treats its input as one flat string, matching
upstream, so a path leaves separators and duplicated folder text in the
title. This strips a real directory prefix first and recovers a title that
lives only in the parent folder. Both / and \ work on every platform,
including UNC and drive-letter roots.
Without a directory prefix this is exactly parse, and a
separator inside a title (Fate/stay night) is left alone.
let elements = anitomy_ng::parse_path(
"Frieren (01-12) [Batch]/Frieren - 05 [1080p].mkv",
anitomy_ng::Options::default(),
);
let title = elements.iter().find(|e| e.kind == anitomy_ng::ElementKind::Title);
assert_eq!(title.map(|e| e.value.as_str()), Some("Frieren"));For a set of related files, prefer parse_together, which additionally
uses what varies across the set.