TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
PyonFX和TCAX的字幕输出函数
[打印本页]
作者:
Seekladoom
时间:
2022-4-5 23:47:23
标题:
PyonFX和TCAX的字幕输出函数
本帖最后由 Seekladoom 于 2022-4-5 23:48 编辑
PyonFX的字幕输出函数
def write_line(self, line: Line) -> Optional[TypeError]:
"""Appends a line to the output list (which is private) that later on will be written to the output file when calling save().
Use it whenever you've prepared a line, it will not impact performance since you
will not actually write anything until :func:`save` will be called.
Parameters:
line (:class:`Line`): A line object. If not valid, TypeError is raised.
"""
if isinstance(line, Line):
self.__output.append(
"\n%s: %d,%s,%s,%s,%s,%04d,%04d,%04d,%s,%s"
% (
"Comment" if line.comment else "Dialogue",
line.layer,
Convert.time(max(0, int(line.start_time))),
Convert.time(max(0, int(line.end_time))),
line.style,
line.actor,
line.margin_l,
line.margin_r,
line.margin_v,
line.effect,
line.text,
)
)
self.__plines += 1
else:
raise TypeError("Expected Line object, got %s." % type(line))
复制代码
TCAX的字幕输出函数
def ass_main(ASS_BUF, SubDlg = '', Event = '', Text = ''):
if Event == '':
ASS_BUF.append('{0}{1}{2}\r\n'.format(SubDlg, Event, Text))
else:
ASS_BUF.append('{0}{{{1}}}{2}\r\n'.format(SubDlg, Event, Text))
复制代码
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2