From f1fb64f592913615d76324964a533202c9b324f1 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sat, 21 Dec 2024 19:29:09 +0530 Subject: Improve README.md --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 2 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a9c5262..1c6e9e5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,48 @@ # srtfilter -Parser for the SubRip/SRT format and framework for filters that modify SRT files. +Parser for SubRip (SRT) subtitle format and framework for utilities that manipulate it. + +Install from PyPI: [`srtfilter`](https://pypi.org/project/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 + +- [x] Parse SRT +- [x] Make CLI tool modular +- [x] Add filter for breaking lines +- [ ] Parse timecodes and allow arithmetic with them +- [ ] More filters? As and when use-cases emerge diff --git a/pyproject.toml b/pyproject.toml index dc0a102..ed89b87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "srtfilter" -version = "0.1.0" +version = "0.1.1" authors = [ { name="Arjun Satarkar", email="me@arjunsatarkar.net" }, ] -- cgit v1.2.3-57-g22cb