Skip to content

Commit

Permalink
conf path这里自己管理 不再由main下发
Browse files Browse the repository at this point in the history
和db位置h获取一样
  • Loading branch information
yjqiang committed Apr 26, 2019
1 parent c01c1c1 commit fb5639b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
16 changes: 7 additions & 9 deletions conf_loader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from os import path
import toml


Expand All @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 1 addition & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import signal
import threading
import asyncio
from os import path
import conf_loader
import notifier
import bili_statistics
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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(),
]
Expand Down

0 comments on commit fb5639b

Please sign in to comment.