forked from AlotOfBlahaj/Auto_Record_Matsuri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
59 lines (49 loc) · 1.79 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from multiprocessing import Process
from bilibili import Bilibili
from config import config
from mirrativ import Mirrativ
from openrec import Openrec
from tools import check_ddir_is_exist, get_logger
from twitcasting import Twitcasting
from youtube import Youtube, start_temp_daemon
logger = get_logger()
class Event:
def __init__(self):
self.events_multi = []
self.gen_process()
logger.info(self.events_multi)
def start(self):
self.start_multi_task()
if config['youtube']['enable_temp']:
temp = Process(target=start_temp_daemon)
temp.run()
for event in self.events_multi:
event.join()
def gen_process(self):
if config['youtube']['enable']:
for user_config in config['youtube']['users']:
y = Youtube(user_config)
self.events_multi.append(y)
if config['twitcasting']['enable']:
for user_config in config['twitcasting']['users']:
t = Twitcasting(user_config)
self.events_multi.append(t)
if config['openrec']['enable']:
for user_config in config['openrec']['users']:
o = Openrec(user_config)
self.events_multi.append(o)
if config['mirrativ']['enable']:
for user_config in config['mirrativ']['users']:
m = Mirrativ(user_config)
self.events_multi.append(m)
if config['bilibili']['enable']:
for user_config in config['bilibili']['users']:
b = Bilibili(user_config)
self.events_multi.append(b)
def start_multi_task(self):
for proc in self.events_multi:
proc.start()
if __name__ == '__main__':
check_ddir_is_exist()
e = Event()
e.start()