feat(indexer): tvsearch with season and episode tags (#78)
ci / web (push) Successful in 50s
ci / rust (push) Successful in 1m18s
e2e / e2e (push) Successful in 1m46s

This commit was merged in pull request #78.
This commit is contained in:
2026-08-22 22:34:04 +01:00
parent fc2a8de58d
commit 8d44225b57
11 changed files with 876 additions and 50 deletions
+3 -30
View File
@@ -159,37 +159,10 @@ fn is_audio_family(t: &str) -> bool {
})
}
/// `S01`, `S01E02`, `S01E01E02`, `S01-E02`, `1x02`.
/// `S01`, `S01E02`, `S01E01E02`, `S01-E02`, `1x02`, `S01-S03`, an air
/// date. Anything that ends the title region on a TV tag.
pub(crate) fn is_season_episode(t: &str) -> bool {
fn digits(s: &str) -> (usize, &str) {
let n = s.bytes().take_while(u8::is_ascii_digit).count();
(n, &s[n..])
}
if let Some(rest) = t.strip_prefix('s') {
let (n, mut rest) = digits(rest);
if !(1..=2).contains(&n) {
return false;
}
while !rest.is_empty() {
let Some(r) = rest.strip_prefix('e').or_else(|| rest.strip_prefix("-e")) else {
return false;
};
let (m, r2) = digits(r);
if !(1..=3).contains(&m) {
return false;
}
rest = r2;
}
return true;
}
let (n, rest) = digits(t);
if (1..=2).contains(&n) {
if let Some(r) = rest.strip_prefix('x') {
let (m, r2) = digits(r);
return (2..=3).contains(&m) && r2.is_empty();
}
}
false
crate::episodes::tag_of(t).is_some()
}
/// A plausible release year: four digits, 1900–2099.