Skip to content

Commit

Permalink
feat: 开放弹幕的各项设置
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Dec 7, 2023
1 parent 38fb0a4 commit fa20e5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,15 @@ async def process_favorite_item(
try:
if not await aexists(fav_item.subtitle_path):
await ass.make_ass_file_danmakus_protobuf(
v, 0, str(fav_item.subtitle_path.resolve())
v,
0,
str(fav_item.subtitle_path.resolve()),
credential=credential,
font_name=settings.subtitle.font_name,
font_size=settings.subtitle.font_size,
alpha=settings.subtitle.alpha,
fly_time=settings.subtitle.fly_time,
static_time=settings.subtitle.static_time,
)
else:
logger.info(
Expand Down
12 changes: 12 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
from constants import DEFAULT_CONFIG_PATH


@dataclass
class SubtitleConfig(DataClassJsonMixin):
dataclass_json_config = {"undefined": Undefined.EXCLUDE}

font_name: str = "微软雅黑,黑体" # 字体
font_size: float = 40 # 字号
alpha: float = 0.8 # 透明度
fly_time: float = 5 # 滚动弹幕持续时间
static_time: float = 10 # 静态弹幕持续时间


@dataclass
class Config(DataClassJsonMixin):
dataclass_json_config = {"undefined": Undefined.EXCLUDE}
Expand All @@ -18,6 +29,7 @@ class Config(DataClassJsonMixin):
ac_time_value: str = ""
interval: int = 20
path_mapper: dict[int, str] = field(default_factory=dict)
subtitle: SubtitleConfig = field(default_factory=SubtitleConfig)

def validate(self) -> Self:
"""所有值必须被设置"""
Expand Down

0 comments on commit fa20e5e

Please sign in to comment.