This commit is contained in:
jxxghp
2024-08-16 13:41:19 +08:00
parent af88618fbd
commit c030f52418
6 changed files with 45 additions and 10 deletions
+5
View File
@@ -15,6 +15,11 @@ from app.utils.http import RequestUtils
class Emby: class Emby:
_host: str = None
_playhost: str = None
_apikey: str = None
user: Optional[Union[str, int]] = None
def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs): def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs):
if not host or not apikey: if not host or not apikey:
logger.error("Emby服务器配置不完整!") logger.error("Emby服务器配置不完整!")
+5
View File
@@ -12,6 +12,11 @@ from app.utils.http import RequestUtils
class Jellyfin: class Jellyfin:
_host: str = None
_apikey: str = None
_playhost: str = None
user: Optional[Union[str, int]] = None
def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs): def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs):
if not host or not apikey: if not host or not apikey:
logger.error("Jellyfin服务器配置不完整!!") logger.error("Jellyfin服务器配置不完整!!")
+1 -1
View File
@@ -276,7 +276,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase):
return None return None
server.set_torrents_tag(ids=hashs, tags=['已整理']) server.set_torrents_tag(ids=hashs, tags=['已整理'])
# 移动模式删除种子 # 移动模式删除种子
if settings.TRANSFER_TYPE in ["move", "rclone_move"]: if settings.TRANSFER_TYPE in ["move"]:
if self.remove_torrents(hashs): if self.remove_torrents(hashs):
logger.info(f"移动模式删除种子成功:{hashs} ") logger.info(f"移动模式删除种子成功:{hashs} ")
# 删除残留文件 # 删除残留文件
+23 -5
View File
@@ -6,7 +6,6 @@ from qbittorrentapi import TorrentDictionary, TorrentFilesList
from qbittorrentapi.client import Client from qbittorrentapi.client import Client
from qbittorrentapi.transfer import TransferInfoDictionary from qbittorrentapi.transfer import TransferInfoDictionary
from app.core.config import settings
from app.log import logger from app.log import logger
@@ -15,17 +14,36 @@ class Qbittorrent:
_port: int = None _port: int = None
_username: str = None _username: str = None
_password: str = None _password: str = None
_category: bool = False
_sequentail: bool = False
_force_resume: bool = False
qbc: Client = None qbc: Client = None
def __init__(self, host: str = None, port: int = None, username: str = None, password: str = None, **kwargs): def __init__(self, host: str = None, port: int = None,
username: str = None, password: str = None,
category: bool = False, sequentail: bool = False, force_resume: bool = False,
**kwargs):
""" """
若不设置参数,则创建配置文件设置的下载器 若不设置参数,则创建配置文件设置的下载器
""" """
if not host:
logger.error("Qbittorrent配置不完整!")
return
self._host = host self._host = host
self._port = port if not port:
# 从host中获取端口
if ":" in host:
host, port = host.split(":")
self._host = host
self._port = int(port)
else:
self._port = port
self._username = username self._username = username
self._password = password self._password = password
self._category = category
self._sequentail = sequentail
self._force_resume = force_resume
if self._host and self._port: if self._host and self._port:
self.qbc = self.__login_qbittorrent() self.qbc = self.__login_qbittorrent()
@@ -246,7 +264,7 @@ class Qbittorrent:
tags = None tags = None
# 分类自动管理 # 分类自动管理
if category and settings.QB_CATEGORY: if category and self._category:
is_auto = True is_auto = True
else: else:
is_auto = False is_auto = False
@@ -260,7 +278,7 @@ class Qbittorrent:
is_paused=is_paused, is_paused=is_paused,
tags=tags, tags=tags,
use_auto_torrent_management=is_auto, use_auto_torrent_management=is_auto,
is_sequential_download=settings.QB_SEQUENTIAL, is_sequential_download=self._sequentail,
cookie=cookie, cookie=cookie,
category=category, category=category,
**kwargs) **kwargs)
+1 -1
View File
@@ -271,7 +271,7 @@ class TransmissionModule(_ModuleBase, _DownloaderBase):
tags = ['已整理'] tags = ['已整理']
server.set_torrent_tag(ids=hashs, tags=tags) server.set_torrent_tag(ids=hashs, tags=tags)
# 移动模式删除种子 # 移动模式删除种子
if settings.TRANSFER_TYPE in ["move", "rclone_move"]: if settings.TRANSFER_TYPE in ["move"]:
if self.remove_torrents(hashs): if self.remove_torrents(hashs):
logger.info(f"移动模式删除种子成功:{hashs} ") logger.info(f"移动模式删除种子成功:{hashs} ")
# 删除残留文件 # 删除残留文件
+10 -3
View File
@@ -22,15 +22,22 @@ class Transmission:
"peersGettingFromUs", "peersSendingToUs", "uploadRatio", "uploadedEver", "downloadedEver", "downloadDir", "peersGettingFromUs", "peersSendingToUs", "uploadRatio", "uploadedEver", "downloadedEver", "downloadDir",
"error", "errorString", "doneDate", "queuePosition", "activityDate", "trackers"] "error", "errorString", "doneDate", "queuePosition", "activityDate", "trackers"]
def __init__(self, host: str, port: int, username: str = None, password: str = None, **kwargs): def __init__(self, host: str = None, port: int = None, username: str = None, password: str = None, **kwargs):
""" """
若不设置参数,则创建配置文件设置的下载器 若不设置参数,则创建配置文件设置的下载器
""" """
if not host or not port: if not host:
logger.error("Transmission配置不完整!") logger.error("Transmission配置不完整!")
return return
self._host = host self._host = host
self._port = port if not port:
# 从host中获取端口
if ":" in host:
host, port = host.split(":")
self._host = host
self._port = int(port)
else:
self._port = port
self._username = username self._username = username
self._password = password self._password = password
if self._host and self._port: if self._host and self._port: