aeidon.agents.OpenAgent

Source: aeidon/agents/open.py

Anchestors: aeidon.delegate.Delegate, builtins.object

class aeidon.agents.OpenAgent
Reading and parsing data from subtitle files.

Methods

OpenAgent.open(doc, path, encoding=None, align_method=None)

Read and parse subtitle data for doc from path.

encoding can be None to use the system default encoding. Return the amount of subtitles that needed to be moved in order to arrange them in ascending chronological order.

Raise IOError if reading fails. Raise UnicodeError if decoding fails. Raise aeidon.FormatError if unable to detect format. Raise aeidon.ParseError if parsing fails.

OpenAgent.open_main(path, encoding=None)

Read and parse subtitle data for main file from path.

encoding can be None to use the system default encoding. Return the amount of subtitles that needed to be moved in order to arrange them in ascending chronological order.

Raise IOError if reading fails. Raise UnicodeError if decoding fails. Raise aeidon.FormatError if unable to detect format. Raise aeidon.ParseError if parsing fails.

OpenAgent.open_translation(path, encoding=None, align_method=None)

Read and parse subtitle data for translation file from path.

encoding can be None to use the system default encoding. align_method specifies how translation texts are attached to existing subtitles. aeidon.align_methods.NUMBER is the simple way, which adds the translation texts in order, one-by-one to the exising subtitles. aeidon.align_methods.POSITION (the default) is the smarter way, which compares the position data in the translation subtitles with the existing subtitles, skips and inserts subtitles as needed to have at least a rough chronological match. The latter thus takes into account that not all subtitles are translated, or vice versa and that one main subtitle may correspond to two translation subtitles, or vice versa, as per length restrictions etc.

Return the amount of subtitles that needed to be moved in order to arrange them in ascending chronological order.

Raise IOError if reading fails. Raise UnicodeError if decoding fails. Raise aeidon.FormatError if unable to detect format. Raise aeidon.ParseError if parsing fails.