srt-process - SRT subtitle processing tool
usage: srt process [-h] [--input FILE] [--output FILE]
[--inplace]
- [--no-strict] [--debug] [--ignore-parsing-errors] [--encoding ENCODING]
-f FUNC [-m MODULE]
Process subtitle text content using arbitrary Python code.
- -h, --help
- show this help message and exit
- --input FILE,
-i FILE
- the file to process (default: stdin)
- --output FILE,
-o FILE
- the file to write to (default: stdout)
- --inplace,
-p
- modify file in place
- --no-strict
- allow blank lines in output, your media player may explode
- --debug
- enable debug logging
- --ignore-parsing-errors,
-c
- try to keep going, even if there are parsing errors
- --encoding
ENCODING, -e ENCODING
- the encoding to read/write files in (default: utf8)
- -f FUNC, --func
FUNC
- a function to use to process lines
- -m MODULE, --module
MODULE
- modules to import in the function context
- Strip HTML-like symbols from a subtitle
- $ srt process -m re -f 'lambda sub:
re.sub("<[^<]+?>", "", sub)'