diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-12-21 14:45:02 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-12-21 14:46:33 +0000 |
commit | daee6a2921d42c9d9d87c86da3f1f8fa9e8d911e (patch) | |
tree | d1f066f927bf4c7cedb6c741a1a1e72df323c79a /README.md | |
parent | f1fb64f592913615d76324964a533202c9b324f1 (diff) | |
download | srtfilter-daee6a2921d42c9d9d87c86da3f1f8fa9e8d911e.tar srtfilter-daee6a2921d42c9d9d87c86da3f1f8fa9e8d911e.tar.gz srtfilter-daee6a2921d42c9d9d87c86da3f1f8fa9e8d911e.zip |
Parse timecodes into numeric components, improve Justfile
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -20,7 +20,7 @@ More filters can be added in the `src/srtfilter/filters` directory. ### Library -``` +```python import srtfilter.parse as srtparse import sys @@ -28,10 +28,13 @@ 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 + # 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 +# SRT.__str__() produces a valid SRT file from the parsed representation sys.stdout.write(str(srt)) ``` @@ -44,5 +47,5 @@ MIT License; see `LICENSE.txt`. - [x] Parse SRT - [x] Make CLI tool modular - [x] Add filter for breaking lines -- [ ] Parse timecodes and allow arithmetic with them +- [x] Parse timecodes into their numeric components - [ ] More filters? As and when use-cases emerge |