Metadata-Version: 2.4
Name: subgapfix
Version: 0.0.2
Summary: A small CLI tool to extend subtitle durations in SRT files by redefining gaps between subtitles.
Author-email: Reinder Sinnema <reinder@w3bunker.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: srt>=3.5.3

# SubGapFix

A small Python CLI tool to **extend subtitle durations** in `.srt` files so they stay on screen longer and feel more natural to read.  
Designed especially for subtitles generated by [WhisperX](https://github.com/m-bain/whisperX), which often have very tight timings.

## ✨ Features

- Automatically extends subtitles when there’s a gap before the next subtitle.  
- Prevents overlaps by adjusting start/end times safely.  
- Configurable via CLI arguments.

## 📦 Installation

Install from PyPI:

```bash
pip install subgapfix
````

Dependencies used:

* [`srt`](https://pypi.org/project/srt/)

## 🔧 Usage

Basic usage:

```bash
subgapfix input.srt -o easyreading.srt
```

### Options

| Option                     | Default         | Description                                                               |
|----------------------------|-----------------|---------------------------------------------------------------------------|
| `-o, --output`             | `subgapfix.srt` | Output SRT file                                                           |
| `--extend-sub-start, -ess` | `0.5`           | Seconds to add to start of subtitle. Default is `0.5`                     |
| `--extend-sub-end, -ese`   | `2.0`           | Maximum seconds to add to end of subtitle. Default is `2.0`               |
| `--min-gap, -mg`           | `1.0`           | Minimum gap (in seconds) required to apply extension. Default is `1.0`    |


### How It Works

The script reads your `.srt` file, loops through each pair of consecutive subtitles, and lengthens their timings (if applicable) to make them easier to read.  

### Example

Input:

```
1
00:00:01,000 --> 00:00:03,000
Hello there.

2
00:00:06,000 --> 00:00:08,000
How are you?
```

Run:

```bash
subgapfix input.srt -o easyreading.srt
```

Output:

```
1
00:00:01,000 --> 00:00:05,000
Hello there.

2
00:00:05,500 --> 00:00:08,000
How are you?
```

## 💡 Why?

Tools like WhisperX produce accurate subtitles, but their timings are often too **tight** for comfortable reading.
`subgapfix` helps subtitles stay visible longer while keeping synchronization intact.
