add display
This commit is contained in:
parent
04c7c071a3
commit
21b1f1a9c1
@ -29,35 +29,7 @@ class Command(metaclass=Singleton):
|
||||
全局命令管理,消费事件
|
||||
"""
|
||||
# 内建命令
|
||||
_commands = {
|
||||
"/cookiecloud": {
|
||||
"func": CookieCloudChain().process,
|
||||
"description": "同步站点Cookie",
|
||||
"data": {}
|
||||
},
|
||||
"/douban_sync": {
|
||||
"func": DoubanSyncChain().process,
|
||||
"description": "同步豆瓣想看",
|
||||
"data": {}
|
||||
},
|
||||
"/subscribe_refresh": {
|
||||
"func": SubscribeChain().refresh,
|
||||
"description": "刷新订阅",
|
||||
"data": {}
|
||||
},
|
||||
"/subscribe_search": {
|
||||
"func": SubscribeChain().search,
|
||||
"description": "搜索订阅",
|
||||
"data": {
|
||||
'state': 'R',
|
||||
}
|
||||
},
|
||||
"/transfer": {
|
||||
"func": TransferChain().process,
|
||||
"description": "下载文件整理",
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
_commands = {}
|
||||
|
||||
# 退出事件
|
||||
_event = Event()
|
||||
@ -68,6 +40,35 @@ class Command(metaclass=Singleton):
|
||||
# 插件管理器
|
||||
self.pluginmanager = PluginManager()
|
||||
# 汇总插件命令
|
||||
self._commands = {
|
||||
"/cookiecloud": {
|
||||
"func": CookieCloudChain().process,
|
||||
"description": "同步站点Cookie",
|
||||
"data": {}
|
||||
},
|
||||
"/douban_sync": {
|
||||
"func": DoubanSyncChain().process,
|
||||
"description": "同步豆瓣想看",
|
||||
"data": {}
|
||||
},
|
||||
"/subscribe_refresh": {
|
||||
"func": SubscribeChain().refresh,
|
||||
"description": "刷新订阅",
|
||||
"data": {}
|
||||
},
|
||||
"/subscribe_search": {
|
||||
"func": SubscribeChain().search,
|
||||
"description": "搜索订阅",
|
||||
"data": {
|
||||
'state': 'R',
|
||||
}
|
||||
},
|
||||
"/transfer": {
|
||||
"func": TransferChain().process,
|
||||
"description": "下载文件整理",
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
plugin_commands = self.pluginmanager.get_plugin_commands()
|
||||
for command in plugin_commands:
|
||||
self.register(
|
||||
|
19
app/helper/display.py
Normal file
19
app/helper/display.py
Normal file
@ -0,0 +1,19 @@
|
||||
from pyvirtualdisplay import Display
|
||||
|
||||
from app.log import logger
|
||||
from app.utils.singleton import Singleton
|
||||
|
||||
|
||||
class DisplayHelper(metaclass=Singleton):
|
||||
_display: Display = None
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
self._display = Display(visible=False, size=(1024, 768))
|
||||
self._display.start()
|
||||
except Exception as err:
|
||||
logger.error(f"DisplayHelper init error: {err}")
|
||||
|
||||
def stop(self):
|
||||
if self._display:
|
||||
self._display.stop()
|
Binary file not shown.
Binary file not shown.
11
app/main.py
11
app/main.py
@ -8,6 +8,7 @@ from app.core.config import settings
|
||||
from app.core.module import ModuleManager
|
||||
from app.core.plugin import PluginManager
|
||||
from app.db.init import init_db, update_db
|
||||
from app.helper.display import DisplayHelper
|
||||
from app.helper.sites import SitesHelper
|
||||
from app.scheduler import Scheduler
|
||||
|
||||
@ -35,6 +36,8 @@ def shutdown_server():
|
||||
ModuleManager().stop()
|
||||
# 停止事件消费
|
||||
Command().stop()
|
||||
# 停止虚拟显示
|
||||
DisplayHelper().stop()
|
||||
|
||||
|
||||
@App.on_event("startup")
|
||||
@ -42,18 +45,18 @@ def start_module():
|
||||
"""
|
||||
启动模块
|
||||
"""
|
||||
# 虚伪显示
|
||||
DisplayHelper()
|
||||
# 加载模块
|
||||
ModuleManager()
|
||||
# 加载插件
|
||||
PluginManager()
|
||||
# 加载站点
|
||||
SitesHelper()
|
||||
# 启动定时服务
|
||||
Scheduler()
|
||||
# 启动事件消费
|
||||
Command()
|
||||
# 用户认证
|
||||
SitesHelper().check_user()
|
||||
# 站点管理
|
||||
SitesHelper()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -39,3 +39,6 @@ torrentool~=1.2.0
|
||||
slack_bolt~=1.18.0
|
||||
slack_sdk~=3.21.3
|
||||
chardet~=4.0.0
|
||||
starlette~=0.27.0
|
||||
PyVirtualDisplay~=3.0
|
||||
Cython~=0.29.35
|
Loading…
x
Reference in New Issue
Block a user