diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-12-21 13:59:09 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-12-21 13:59:09 +0000 |
commit | f1fb64f592913615d76324964a533202c9b324f1 (patch) | |
tree | 4678605723ce8229bef0b38bc2e95470afd021fb /README.md | |
parent | df5a7db84432f4f60698b2ddb97a9f8955dd97fb (diff) | |
download | srtfilter-f1fb64f592913615d76324964a533202c9b324f1.tar srtfilter-f1fb64f592913615d76324964a533202c9b324f1.tar.gz srtfilter-f1fb64f592913615d76324964a533202c9b324f1.zip |
Improve README.md
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 47 |
1 files changed, 46 insertions, 1 deletions
@@ -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 |