1111 Comment ,
1212 CommentPosition ,
1313 Rows ,
14- get_zoom_factor ,
15- parse_special_comment ,
1614 read_comments_from_protobuf ,
1715 read_comments_from_xml ,
1816 write_comment_with_animation ,
1917 write_head ,
2018 write_normal_comment ,
19+ write_special_comment ,
2120)
2221
2322if TYPE_CHECKING :
@@ -38,52 +37,12 @@ def read_comments_bilibili_protobuf(protobuf: bytes | str, fontsize: float) -> l
3837 return read_comments_from_protobuf (protobuf , fontsize )
3938
4039
41- BILI_PLACYER_SIZE = (891 , 589 )
42-
43-
4440class AssText :
4541 def __init__ (self ):
4642 self ._text = ""
4743
48- def write_comment_special (self , comment : Comment , width , height , styleid ):
49- zoom_factor = get_zoom_factor (BILI_PLACYER_SIZE , (width , height ))
50- try :
51- (
52- (rotate_y , rotate_z , from_x , from_y , to_x , to_y ),
53- from_alpha ,
54- to_alpha ,
55- text ,
56- delay ,
57- lifetime ,
58- duration ,
59- fontface ,
60- is_border ,
61- ) = parse_special_comment (comment .comment , zoom_factor )
62-
63- self .write_comment_with_animation (
64- comment ,
65- width ,
66- height ,
67- rotate_y ,
68- rotate_z ,
69- from_x ,
70- from_y ,
71- to_x ,
72- to_y ,
73- from_alpha ,
74- to_alpha ,
75- text ,
76- delay ,
77- lifetime ,
78- duration ,
79- fontface ,
80- is_border ,
81- styleid ,
82- zoom_factor ,
83- )
84-
85- except ValueError :
86- logging .warning (f"Invalid comment: { comment .comment !r} " )
44+ def write_special_comment (self , comment : Comment , width , height , styleid ) -> None :
45+ self ._text += write_special_comment (comment , width , height , styleid )
8746
8847 def write_head (self , width : int , height : int , fontface : str , fontsize : float , alpha : float , styleid : str ) -> None :
8948 self ._text += write_head (width , height , fontface , fontsize , alpha , styleid )
@@ -209,7 +168,7 @@ def process_comments(
209168 reduced ,
210169 )
211170 elif comment .pos == CommentPosition .Special :
212- ass .write_comment_special (comment , width , height , styleid )
171+ ass .write_special_comment (comment , width , height , styleid )
213172 else :
214173 logging .warning (f"Invalid comment: { comment .comment !r} " )
215174 if progress_callback :
0 commit comments