File: api-reference.rst

package info (click to toggle)
python-pysubs2 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,840 kB
  • sloc: python: 4,016; makefile: 163
file content (153 lines) | stat: -rw-r--r-- 3,445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
API Reference
=============

``pysubs2`` --- the main module
-------------------------------

.. automodule:: pysubs2
   :members: load, load_from_whisper, make_time, Color, VERSION

.. autoenum:: pysubs2.Alignment

``SSAFile`` --- a subtitle file
-------------------------------

.. autoclass:: pysubs2.SSAFile
   :members: events, styles, info, fps, format, aegisub_project, fonts_opaque

Reading and writing subtitles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using path to file
++++++++++++++++++

.. automethod:: SSAFile.load
.. automethod:: SSAFile.save

Using string
++++++++++++

.. automethod:: SSAFile.from_string
.. automethod:: SSAFile.to_string

Using file object
+++++++++++++++++

.. automethod:: SSAFile.from_file
.. automethod:: SSAFile.to_file

Retiming subtitles
~~~~~~~~~~~~~~~~~~

.. automethod:: SSAFile.shift
.. automethod:: SSAFile.transform_framerate

Working with styles
~~~~~~~~~~~~~~~~~~~

.. automethod:: SSAFile.rename_style
.. automethod:: SSAFile.import_styles

Misc methods
~~~~~~~~~~~~

.. automethod:: SSAFile.remove_miscellaneous_events
.. automethod:: SSAFile.equals
.. automethod:: SSAFile.sort


``SSAEvent`` --- one subtitle
-----------------------------

.. autoclass:: pysubs2.SSAEvent
   :members:

``SSAStyle`` --- a subtitle style
---------------------------------

.. autoclass:: pysubs2.SSAStyle
   :members:

``pysubs2.time`` --- time-related utilities
-------------------------------------------

.. automodule:: pysubs2.time
   :members:
   :exclude-members: Times

``pysubs2.exceptions`` --- thrown exceptions
--------------------------------------------

.. automodule:: pysubs2.exceptions
   :members:
   :show-inheritance:

``pysubs2.formats`` --- subtitle format implementations
-------------------------------------------------------

.. note:: This subpackage contains pysubs2 internals. It's mostly of interest if you're looking to implement
          a subtitle format not supported by the library. In that case, have a look at :class:`pysubs2.formats.FormatBase`.

.. autofunction:: pysubs2.formats.substation.parse_tags

.. automodule:: pysubs2.formats
   :members:

Subtitle format API
~~~~~~~~~~~~~~~~~~~

.. autoclass:: pysubs2.formats.FormatBase
   :members:

.. _subtitle-format-implementations:

Subtitle format implementations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here you can find specific details regarding support of the individual subtitle formats.

.. tip::
   Some formats support additional keyword parameters in their ``from_file()`` or ``to_file()`` methods.
   These are used to customize the parser/writer behaviour.


.. autoclass:: pysubs2.formats.substation.SubstationFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.subrip.SubripFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.mpl2.MPL2Format
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.tmp.TmpFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.webvtt.WebVTTFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.ttml.TTMLFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.sami.SAMIFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.microdvd.MicroDVDFormat
   :members:
   :show-inheritance:

.. autoclass:: pysubs2.formats.jsonformat.JSONFormat
   :members:
   :show-inheritance:

Misc functions
--------------

.. autofunction:: pysubs2.whisper.load_from_whisper