Convert non-SRT downloads to SRT #213
Notifications
Due Date
No due date set.
Blocks
Depends on
Reference: yolo/arr#213
Reference in New Issue
Block a user
DESIGN.md §15 says sidecars are SRT. Providers serve other things:
SubtitleFormatalready namesAssandVttalongsideSrt(#184), andits own docs say converting "is not this crate's decision to make silently".
No issue makes that decision. As it stands a downloaded ASS or VTT file
would either be written into the title folder under an
.srtname while notbeing SRT, or dropped on the floor — neither is right.
Convert to SRT in
arr-subsafter decoding (see the encoding issue thisdepends on) and before sync and write:
Vttto SRT: strip theWEBVTTheader and cue settings, rewrite the./,millisecond separator, renumber cues.Assto SRT: take the dialogue events in time order, strip override tags(
{\an8}and friends), and drop styling. Losing styling is the acceptedcost of §15's one-format-on-disk rule.
Srtpasses through untouched.SubtitleFormat::Other) is a failed attempt with a reason,not a silent skip.
arr_subs::srt::Cuefrom #190 is the target shape — rendering it is alreadywritten, so this is a parser per input format, not a new writer.
Found while implementing #190.
Depends on: #184, #190
Implemented conversion of downloaded non-SRT subtitles to SRT in
arr-subs, per DESIGN.md §15's one-format-on-disk rule. Addedcrates/arr-subs/src/convert.rs, exposingFetched::to_srt(&self): SRT passes through untouched, VTT is parsed (WEBVTT header/NOTE/STYLE/REGION blocks and cue settings stripped,.millisecond separator, optional-hours timestamps) intoCues and rendered with the existingsrt::renderfrom #190, ASS/SSADialogue:events from[Events]are parsed, sorted into time order, override tags ({\an8}etc.) stripped and\N/\nturned into real line breaks, then rendered the same way.SubtitleFormat::Otherand any parser rejection produce a newError::Convert { candidate, format, detail }rather than a silent skip. 8 new unit tests cover passthrough, header/settings stripping, hours-optional VTT timestamps, ASS time-ordering/tag-stripping/line-breaks, and malformed-input failure for both formats.Branch:
subtitles/213-to-srt(based onblitz/subtitles), pushed.just cipassed: 564/564 tests, clippy and fmt clean.Findings
None outside this issue's scope.
naps62-yolo referenced this issue2026-08-25 00:41:21 +01:00