pysublib.file — Base for the individual subtitle files

See also

Supported formats as well as the implementation of the individual modules in pysublib.formats module.

class pysublib.file.SubtitleFile([path[, encoding[, newline[, lines]]]])
Parameters:
  • path (string) – path to the file on the filesystem
  • encoding (string) – encoding used to open the file
  • newline (char) – character representing new line in the file
  • lines (list) – lines of raw data

Base class representing subtitle file object. All the subtitle file classes representing specific subtitle format, e.g. pysublib.formats.microdvd.MicroDVDFile inherit from this class.

path
Path to the file on the file system.
encoding
Encoding (to be) used to read the file.
lines
A list of lines read from the file; contains raw data.
newline
Character representing new line character in the specified file.
identifier
Regular expression object used to identify the subtitle format.
format
Raises:TypeError

Common string representation of the subtitle format. Read only.

mode
Raises:TypeError

Subtitle file mode. Read only.

read()
Raises:NotImplementedError

Calling this method on an instance of SubtitleFile will always raise a NotImplementedError excemption. This method is properly implemented only in classes inheriting from this class, e.g. pysublib.formats.subrip.SubRipFile.

write()
Raises:NotImplementedError

Calling this method on an instance of SubtitleFile will always raise a NotImplementedError excemption. This method is properly implemented only in classes inheriting from this class, e.g. pysublib.formats.subrip.SubRipFile.

Previous topic

pysublib.core — Core functions, classes and methods

Next topic

pysublib.formats — Objects representing individual subtitle files

This Page