Skip to main content

No project description provided

Project description

srtfilter

Parser for SubRip (SRT) subtitle format and framework for utilities that manipulate it.

Install from PyPI: srtfilter.

Usage

CLI tool

Parse and reproduce an SRT file (output goes to stdout):

srtfilter input.srt

Break lines automatically (to handle existing files with poor line breaks):

srtfilter --filter rebreak_lines input.srt

More filters can be added in the src/srtfilter/filters directory.

Library

import srtfilter.parse as srtparse
import sys

with open("input.srt") as f:
    srt = srtparse.SRT.from_str(f.read())

for event in srt.events:
    print(event.start, event.end, event.content)
    event.content = event.content.upper() # for example

# srt.__str__() produces a valid SRT file from the parsed representation
sys.stdout.write(str(srt))

License

MIT License; see LICENSE.txt.

Roadmap

  • Parse SRT
  • Make CLI tool modular
  • Add filter for breaking lines
  • Parse timecodes and allow arithmetic with them
  • More filters? As and when use-cases emerge

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

srtfilter-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

srtfilter-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file srtfilter-0.1.1.tar.gz.

File metadata

  • Download URL: srtfilter-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for srtfilter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fef26f1f1ff842a3148208207d155c1f67d2c7900b04c7eaea0c60e5a1dcf93e
MD5 073ca4cd5a2effb25f6b94d0fba733c4
BLAKE2b-256 8ec799b0a43f5ec50d7ad3e84309b8e4a575e0247a5ffb1cd286a5b073d85743

See more details on using hashes here.

File details

Details for the file srtfilter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: srtfilter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for srtfilter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6db5f73afeb89a3ac265246e139df40a68c662d8734c1497fadd18f1cf077235
MD5 9176c64e9580a7c9f6d5eddfc9576bf2
BLAKE2b-256 21e5b4aab2a54e393f7c15b7d09dee92839fe13694b235fe2d5a6aac21bcb9b8

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