aeidon.SubtitleFile¶
Source: aeidon/file.py
Anchestors: builtins.object
- class aeidon.SubtitleFile¶
Base class for subtitle files.
- SubtitleFile.format¶
aeidon.formats item corresponding to file format
- SubtitleFile.mode¶
aeidon.modes item corresponding to native positions
- SubtitleFile.encoding¶
Character encoding used to read and write file
- SubtitleFile.has_utf_16_bom¶
True if BOM found for UTF-16-BE or UTF-16-LE
- SubtitleFile.header¶
String of metadata at the top of the file
- SubtitleFile.newline¶
aeidon.newlines item, detected upon read
- SubtitleFile.path¶
Full, absolute path to the file on disk
If the file format contains a header, it will default to a fairly blank template header read upon instantiation of the class, from either aeidon.DATA_DIR/headers or aeidon.DATA_HOME_DIR/headers. If the read file contains a header, it will replace the template.
Methods¶
- SubtitleFile.__init__(path, encoding, newline=None)¶
Initialize a SubtitleFile instance.
- SubtitleFile.copy_from(other)¶
Copy generic properties from other.
- SubtitleFile.read()¶
Read file and return subtitles.
Raise IOError if reading fails. Raise UnicodeError if decoding fails.
- SubtitleFile.write(subtitles, doc)¶
Write subtitles with text from doc to file.
Raise IOError if writing fails. Raise UnicodeError if encoding fails.
- SubtitleFile.write_to_file(subtitles, doc, f)¶
Write subtitles with text from doc to file f.
Raise IOError if writing fails. Raise UnicodeError if encoding fails.