feat: support vtt in sync and fmt

This commit is contained in:
CDN 2025-04-23 15:29:27 +08:00
parent a6284897c8
commit 2fa12dbcde
Signed by: CDN
GPG key ID: 0C656827F9F80080
4 changed files with 122 additions and 1 deletions

View file

@ -107,6 +107,7 @@ sub-cli sync <source> <target>
Currently, synchronization only works between files of the same format:
- SRT to SRT
- LRC to LRC
- VTT to VTT
### Behavior Details
@ -127,6 +128,16 @@ Currently, synchronization only works between files of the same format:
- **Preserved from target**: All subtitle text content.
- **Modified in target**: Timestamps are updated and entry numbers are standardized (sequential from 1).
#### For VTT Files:
- **When entry counts match**: Both start and end times from the source are directly applied to the target entries.
- **When entry counts differ**: A scaled approach is used, similar to SRT synchronization:
- Start times are taken from proportionally matched source entries
- End times are calculated based on source entry durations
- The timing relationship between entries is preserved
- **Preserved from target**: All subtitle text content, formatting, cue settings, and styling.
- **Modified in target**: Timestamps are updated and cue identifiers are standardized (sequential from 1).
### Edge Cases
- If the source file has no timing information, the target remains unchanged.
@ -142,6 +153,9 @@ sub-cli sync reference.srt target.srt
# Synchronize an LRC file using another LRC file as reference
sub-cli sync reference.lrc target.lrc
# Synchronize a VTT file using another VTT file as reference
sub-cli sync reference.vtt target.vtt
```
## fmt