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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file srtfilter-0.2.0.tar.gz.
File metadata
- Download URL: srtfilter-0.2.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2de694cf0554338a79f2de3d537a10e28264c7828b01517df4f0dca41cefd766
|
|
| MD5 |
a82293fff3a88a425e4f995cdab1ce8c
|
|
| BLAKE2b-256 |
7b0e2490798d779f9f2e5e5adc0f8c119d7068bbf6ae0ae8943428d79b7045cc
|
File details
Details for the file srtfilter-0.2.0-py3-none-any.whl.
File metadata
- Download URL: srtfilter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda6e4a5ff8e5b5956363f1b377d3a5282467a59aa811a807a4fc165ab9d35e4
|
|
| MD5 |
831ce7ab6363526a7cdfafd0de59e142
|
|
| BLAKE2b-256 |
fc773c3caa782260d6dab8e0181d8bb668c94ee54525dec0e665796d4b5a33e9
|