aeidon is a Python package that provides classes and functions for dealing with text-based subtitle files of many different formats. Functions exist for reading and writing subtitle files as well as manipulating subtitle data, i.e. positions (times or frames) and texts.
Converting a file from the SubRip format to the MicroDVD format:
project = aeidon.Project()
project.open_main("/path/to/file.srt", "utf_8")
project.set_framerate(aeidon.framerates.FPS_23_976)
project.save_main(aeidon.files.new(aeidon.formats.MICRODVD,
"/path/to/file.sub",
"utf_8"))Making all subtitles in a file appear two seconds earlier:
project = aeidon.Project()
project.open_main("/path/to/file.srt", "utf_8")
project.shift_positions(None, aeidon.as_seconds(-2))
project.save_main()pip install -U aeidonhttps://otsaloma.io/gaupol/doc/api/aeidon.html
The API documentation is for an older version, but it applies 99% to the latest version as well. There's currently no build mechanism for up-to-date API documentation. Restoring that is a known low-priority issue.
aeidon is part of the Gaupol subtitle editor, where the other package, gaupol, provides the GTK user interface.