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

 找回密码
 新人加入
查看: 2322|回复: 0

[其他代码] PyonFX和TCAX的字幕输出函数 [复制链接]

Rank: 4

发表于 2022-4-5 23:47:23 |显示全部楼层
本帖最后由 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))
复制代码

您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-3-29 02:10

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH