fix file transfer
This commit is contained in:
@ -9,6 +9,7 @@ from qbittorrentapi.client import Client
|
||||
from app.core import settings
|
||||
from app.log import logger
|
||||
from app.utils.singleton import Singleton
|
||||
from app.utils.string import StringUtils
|
||||
|
||||
|
||||
class Qbittorrent(metaclass=Singleton):
|
||||
@ -21,10 +22,7 @@ class Qbittorrent(metaclass=Singleton):
|
||||
qbc: Client = None
|
||||
|
||||
def __init__(self):
|
||||
host = settings.QB_HOST
|
||||
if host and host.find(":") != -1:
|
||||
self._host = settings.QB_HOST.split(":")[0]
|
||||
self._port = settings.QB_HOST.split(":")[1]
|
||||
self._host, self._port = StringUtils.get_domain_address(settings.QB_HOST)
|
||||
self._username = settings.QB_USER
|
||||
self._password = settings.QB_PASSWORD
|
||||
if self._host and self._port and self._username and self._password:
|
||||
|
@ -33,13 +33,13 @@ class Telegram(metaclass=Singleton):
|
||||
|
||||
@_bot.message_handler(func=lambda message: True)
|
||||
def echo_all(message):
|
||||
RequestUtils(timeout=10).post_res(self._ds_url, json=message.json)
|
||||
RequestUtils(timeout=5).post_res(self._ds_url, json=message.json)
|
||||
|
||||
def run_polling():
|
||||
"""
|
||||
定义线程函数来运行 infinity_polling
|
||||
"""
|
||||
_bot.infinity_polling()
|
||||
_bot.infinity_polling(long_polling_timeout=5)
|
||||
|
||||
# 启动线程来运行 infinity_polling
|
||||
self._polling_thread = threading.Thread(target=run_polling)
|
||||
|
@ -7,6 +7,7 @@ from transmission_rpc import Client, Torrent, File
|
||||
from app.core import settings
|
||||
from app.log import logger
|
||||
from app.utils.singleton import Singleton
|
||||
from app.utils.string import StringUtils
|
||||
|
||||
|
||||
class Transmission(metaclass=Singleton):
|
||||
@ -25,10 +26,7 @@ class Transmission(metaclass=Singleton):
|
||||
"error", "errorString", "doneDate", "queuePosition", "activityDate", "trackers"]
|
||||
|
||||
def __init__(self):
|
||||
host = settings.TR_HOST
|
||||
if host and host.find(":") != -1:
|
||||
self._host = settings.TR_HOST.split(":")[0]
|
||||
self._port = settings.TR_HOST.split(":")[1]
|
||||
self._host, self._port = StringUtils.get_domain_address(settings.QB_HOST)
|
||||
self._username = settings.TR_USER
|
||||
self._password = settings.TR_PASSWORD
|
||||
if self._host and self._port and self._username and self._password:
|
||||
|
Reference in New Issue
Block a user