docs: add README.md to document script functionality and commands

This commit is contained in:
Emmanuel BENOîT 2025-04-11 12:04:11 +02:00
parent 111def32bf
commit 47b22fb081
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg

66
README.md Normal file
View file

@ -0,0 +1,66 @@
# SRTMerger
## Overview
The `SRTMerger` script is designed to merge and manipulate subtitle files in the SRT format. It takes two SRT files and a set of commands to produce a merged output file.
## Usage
The script is initialized with four parameters:
- `srt1_filename`: The filename of the first SRT file.
- `srt2_filename`: The filename of the second SRT file.
- `commands_filename`: The filename containing the commands to process.
- `output_filename`: The filename where the merged output will be saved.
## Supported Commands
The script supports the following commands:
### COPY
Copies subtitles from one file to the output.
**Syntax:**
```
COPY <source> <start> <end>
```
- `<source>`: The source SRT file (`srt1` or `srt2`).
- `<start>`: The starting index of the subtitles to copy.
- `<end>`: The ending index of the subtitles to copy.
### MAP
Maps text from one file to another with a time offset.
**Syntax:**
```
MAP <text_source> <text_start> <time_start> <count>
```
- `<text_source>`: The source SRT file for text (`srt1` or `srt2`).
- `<text_start>`: The starting index of the text to map.
- `<time_start>`: The starting index of the time to map.
- `<count>`: The number of subtitles to map.
### SYNC
Synchronizes subtitles between files.
**Syntax:**
```
SYNC <text_source> <text_index> <time_index>
```
- `<text_source>`: The source SRT file for text (`srt1` or `srt2`).
- `<text_index>`: The index of the text to synchronize.
- `<time_index>`: The index of the time to synchronize.
### PUT
Puts a specific text at a given index.
**Syntax:**
```
PUT <source> <index> <text>
```
- `<source>`: The source SRT file (`srt1` or `srt2`).
- `<index>`: The index where the text should be placed.
- `<text>`: The text to insert.
## Output
The processed commands will generate a merged SRT file saved to the specified `output_filename`.