Skip to main content

Tune SRT subtitle timings with ease

Project description

subtune

Tests Release

A CLI tool for adjusting SRT subtitle timestamps with precision and safety.

Features

  • Precise timing adjustment - Shift subtitles by milliseconds
  • Safe operations - Optional backup creation before modifications
  • Robust validation - Input validation with helpful error messages

Installation

Install from PyPI:

pip install subtune

Or install from source:

git clone https://github.com/rafa-garcia/subtune.git
cd subtune
pip install .

Usage

Basic Usage

# Shift subtitles 2 seconds later
subtune input.srt --offset 2000 output.srt

# Shift subtitles 1.5 seconds earlier  
subtune input.srt --offset -1500 output.srt

Advanced Options

# Modify in-place with backup
subtune input.srt --offset 1000 --backup

# Short flags
subtune input.srt -o 1000 -b

Command Reference

$ subtune --help
usage: subtune [-h] -o OFFSET [--output OUTPUT] [-b] [--version] input_file

Shift SRT subtitle timestamps by a specified offset

positional arguments:
  input_file            Input SRT file path

optional arguments:
  -h, --help            show this help message and exit
  -o OFFSET, --offset OFFSET
                        Time offset in milliseconds (positive=forward,
                        negative=backward)
  --output OUTPUT       Output file path (default: modify input file in-place)
  -b, --backup          Create backup of input file before modification
  --version             show program's version number and exit

Development

Quick Start

# Install development dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Verbose output with details
pytest -v

# Run specific test file
pytest tests/test_cli.py

# Run tests with coverage
pytest --cov=src/subtune

# Generate HTML coverage report
pytest --cov=src/subtune --cov-report=html
open htmlcov/index.html

# Check code quality
ruff check src/ tests/

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subtune-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

subtune-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file subtune-1.0.0.tar.gz.

File metadata

  • Download URL: subtune-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for subtune-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c871f35eea292d0f30293909d80a770c7e34cdf67eb0a3bd2739e4334a946464
MD5 a6d1d57a8d7bae1e823b4ad4fc5e98aa
BLAKE2b-256 c8ae119d0058dfd41776dafe7964fe8fa89f0449af6357a2a223bc16e195727d

See more details on using hashes here.

File details

Details for the file subtune-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: subtune-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for subtune-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5a69db38cd3420dfe37e626fb8481d8ab2acc043d1f00590ca6f0d8032d8819
MD5 606b2b22cbe410df32031d61aa8ecffd
BLAKE2b-256 afd13e0979f8cd08c34fbbb8a193e118aa95f3724dba539d573c8f3d323d0d47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page