TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua

标题: PyonFX和TCAX的字幕输出函数 [打印本页]

作者: Seekladoom    时间: 2022-4-5 23:47:23     标题: PyonFX和TCAX的字幕输出函数

本帖最后由 Seekladoom 于 2022-4-5 23:48 编辑

PyonFX的字幕输出函数
  1.     def write_line(self, line: Line) -> Optional[TypeError]:
  2.         """Appends a line to the output list (which is private) that later on will be written to the output file when calling save().

  3.         Use it whenever you've prepared a line, it will not impact performance since you
  4.         will not actually write anything until :func:`save` will be called.

  5.         Parameters:
  6.             line (:class:`Line`): A line object. If not valid, TypeError is raised.
  7.         """
  8.         if isinstance(line, Line):
  9.             self.__output.append(
  10.                 "\n%s: %d,%s,%s,%s,%s,%04d,%04d,%04d,%s,%s"
  11.                 % (
  12.                     "Comment" if line.comment else "Dialogue",
  13.                     line.layer,
  14.                     Convert.time(max(0, int(line.start_time))),
  15.                     Convert.time(max(0, int(line.end_time))),
  16.                     line.style,
  17.                     line.actor,
  18.                     line.margin_l,
  19.                     line.margin_r,
  20.                     line.margin_v,
  21.                     line.effect,
  22.                     line.text,
  23.                 )
  24.             )
  25.             self.__plines += 1
  26.         else:
  27.             raise TypeError("Expected Line object, got %s." % type(line))
复制代码

TCAX的字幕输出函数
  1. def ass_main(ASS_BUF, SubDlg = '', Event = '', Text = ''):
  2.     if Event == '':
  3.         ASS_BUF.append('{0}{1}{2}\r\n'.format(SubDlg, Event, Text))
  4.     else:
  5.         ASS_BUF.append('{0}{{{1}}}{2}\r\n'.format(SubDlg, Event, Text))
复制代码






欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://www.tcax.org/) Powered by Discuz! X2