diff --git a/conf_loader.py b/conf_loader.py index 596ae7d..bbc0481 100644 --- a/conf_loader.py +++ b/conf_loader.py @@ -1,3 +1,4 @@ +from os import path import toml @@ -12,11 +13,12 @@ def rgb_to_percent(list_rgb): class ConfLoader(): - def set_path(self, root_path): - self.file_color = f'{root_path}/conf/color.toml' - self.file_user = f'{root_path}/conf/user.toml' - self.file_bili = f'{root_path}/conf/bili.toml' - self.file_ctrl = f'{root_path}/conf/ctrl.toml' + def __init__(self): + path_conf = f'{path.dirname(path.realpath(__file__))}/conf' + self.file_color = f'{path_conf}/color.toml' + self.file_user = f'{path_conf}/user.toml' + self.file_bili = f'{path_conf}/bili.toml' + self.file_ctrl = f'{path_conf}/ctrl.toml' ''' self.dict_color = self.read_color() @@ -69,10 +71,6 @@ def read_ctrl(self): var = ConfLoader() -def set_path(root_path): - var.set_path(root_path) - - def write_user(dict_new, user_id): var.write_user(dict_new, user_id) diff --git a/run.py b/run.py index 20b1a80..1abc1e2 100644 --- a/run.py +++ b/run.py @@ -2,7 +2,6 @@ import signal import threading import asyncio -from os import path import conf_loader import notifier import bili_statistics @@ -30,8 +29,6 @@ from dyn.monitor_dyn_raffle import DynRaffleMonitor from substance.monitor_substance_raffle import SubstanceRaffleMonitor -root_path = path.dirname(path.realpath(__file__)) -conf_loader.set_path(root_path) loop = asyncio.get_event_loop() @@ -94,7 +91,7 @@ async def get_printer_danmu(): notifier.exec_task(-2, BiliMainTask, 0, delay_range=(0, 5)) -other_tasks = [ +other_tasks = [ SubstanceRaffleMonitor().run(), # DynRaffleMonitor(should_join_immediately=True).run(), ]