srt-lines-matching(1)

SRT subtitle processing tool

Section 1 python3-srt bookworm source

Description

SRT-LINES-MATCHING

NAME

srt-lines-matching - SRT subtitle processing tool

DESCRIPTION

usage: srt lines-matching [-h] [--input FILE] [--output FILE] [--inplace]
[--no-strict] [--debug] [--ignore-parsing-errors]

[--encoding ENCODING] -f FUNC [-m MODULE] [-s] [-v]

Filter subtitles that match or don’t match a particular pattern.

options:

-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 match lines

-m MODULE, --module MODULE

modules to import in the function context

-s, --per-subtitle

match the content of each subtitle, not each line

-v, --invert

invert matching -- only match lines returning False

examples:

Only include Chinese lines

$ srt lines-matching -m hanzidentifier -f hanzidentifier.has_chinese

Exclude all lines which only contain numbers

$ srt lines-matching -v -f ’lambda x: x.isdigit()’