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:
    # Make every event start and end a second later
    event.start.second += 1
    event.end.second += 1
    # Capitalize all the displayed text
    event.content = event.content.upper()

# 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 into their numeric components
  • 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.3.0.tar.gz (4.8 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.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for srtfilter-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f891f681b0b3675160721782b2a664beb829cf5a712902d70c262063000765f2
MD5 91fbda45f0c4b3a42e6553f991c2826a
BLAKE2b-256 b8086582008e8dba65b370893c62339b770cda7bbf3e6b12816a6a590b20a060

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for srtfilter-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d37977d733a34248444bb67018096eadba48fd915c177cb1123a2f68a91578e1
MD5 3e314e1a4053eaf66667d69ea669a20f
BLAKE2b-256 57c2c0f56c21dfe827272549447fd61c7841e3bc319ed398e47631468178e8ba

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