增加优酷弹幕下载以及其他改进

This commit is contained in:
xhlove
2020-01-11 17:57:51 +08:00
parent 78083c2295
commit 11edd6dfad
10 changed files with 258 additions and 39 deletions

View File

@@ -3,7 +3,7 @@
'''
# 作者: weimo
# 创建日期: 2020-01-04 19:17:44
# 上次编辑时间: 2020-01-05 14:45:03
# 上次编辑时间 : 2020-01-11 17:25:09
# 一个人的命运啊,当然要靠自我奋斗,但是...
'''
import os
@@ -11,16 +11,19 @@ import os
from basic.ass import get_ass_head, check_font
from methods.assbase import ASS
from methods.sameheight import SameHeight
from pfunc.cfunc import remove_same_danmu
def write_one_video_subtitles(file_path, comments, args):
# 对于合集则每次都都得检查一次 也可以放在上一级 放在这里 考虑后面可能特殊指定字体的情况
font_path, font_style_name = check_font(args.font)
ass_head = get_ass_head(font_style_name, args.font_size)
get_xy_obj = SameHeight("那就写这一句作为初始化测试吧!", font_path=font_path, font_size=args.font_size)
get_xy_obj = SameHeight("那就写这一句作为初始化测试吧!", font_path=font_path, font_size=int(args.font_size))
subtitle = ASS(file_path, get_xy_obj, font=font_style_name)
comments = remove_same_danmu(comments)
for comment in comments:
subtitle.create_new_line(comment)
write_lines_to_file(ass_head, subtitle.lines, file_path)
return comments
def write_lines_to_file(ass_head, lines, file_path):
with open(file_path, "a+", encoding="utf-8") as f: