|
@@ -5,6 +5,7 @@ import signal
|
|
import threading
|
|
import threading
|
|
import time
|
|
import time
|
|
|
|
|
|
|
|
+from src.api.NasToolsClient import NasToolsClient
|
|
from src.services.Aria2Service import Aria2Service
|
|
from src.services.Aria2Service import Aria2Service
|
|
from src.services.RemoteDownloadSerivce import RemoteDownloadService
|
|
from src.services.RemoteDownloadSerivce import RemoteDownloadService
|
|
|
|
|
|
@@ -19,6 +20,10 @@ class Application:
|
|
def __init__(self, config, parent_directory, remote_download_service=True):
|
|
def __init__(self, config, parent_directory, remote_download_service=True):
|
|
self.config = config
|
|
self.config = config
|
|
self.parent_dir = parent_directory
|
|
self.parent_dir = parent_directory
|
|
|
|
+ base_url = config['NSTOOLS']['URL']
|
|
|
|
+ api_key = config['NSTOOLS']['API_KEY']
|
|
|
|
+
|
|
|
|
+ self.nas_tools_api = NasToolsClient(base_url, api_key)
|
|
|
|
|
|
self.aria2_service = Aria2Service(config)
|
|
self.aria2_service = Aria2Service(config)
|
|
|
|
|
|
@@ -30,6 +35,9 @@ class Application:
|
|
# 注册信号处理函数
|
|
# 注册信号处理函数
|
|
signal.signal(signal.SIGINT, self.handle_signal)
|
|
signal.signal(signal.SIGINT, self.handle_signal)
|
|
|
|
|
|
|
|
+ def test_nas_tools_service(self):
|
|
|
|
+ self.nas_tools_api.login('admin', 'password')
|
|
|
|
+
|
|
def handle_signal(self, signum, frame):
|
|
def handle_signal(self, signum, frame):
|
|
"""处理中断信号,优雅地退出循环"""
|
|
"""处理中断信号,优雅地退出循环"""
|
|
self.is_running = False
|
|
self.is_running = False
|