fix
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Set, Tuple, Optional, Union, List
|
||||
|
||||
@ -12,6 +13,7 @@ from app.modules.qbittorrent.qbittorrent import Qbittorrent
|
||||
from app.schemas import TransferInfo, TransferTorrent, DownloadingTorrent
|
||||
from app.schemas.types import TorrentStatus
|
||||
from app.utils.string import StringUtils
|
||||
from app.utils.system import SystemUtils
|
||||
|
||||
|
||||
class QbittorrentModule(_ModuleBase):
|
||||
@ -164,6 +166,12 @@ class QbittorrentModule(_ModuleBase):
|
||||
if settings.TRANSFER_TYPE == "move":
|
||||
if self.remove_torrents(hashs):
|
||||
logger.info(f"移动模式删除种子成功:{hashs} ")
|
||||
# 删除残留文件
|
||||
if transinfo.path and transinfo.path.exists():
|
||||
files = SystemUtils.list_files_with_extensions(transinfo.path, settings.RMT_MEDIAEXT)
|
||||
if not files:
|
||||
logger.warn(f"删除残留文件夹:{transinfo.path}")
|
||||
shutil.rmtree(transinfo.path, ignore_errors=True)
|
||||
|
||||
def remove_torrents(self, hashs: Union[str, list]) -> bool:
|
||||
"""
|
||||
|
@ -1,3 +1,4 @@
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Set, Tuple, Optional, Union, List
|
||||
|
||||
@ -12,6 +13,7 @@ from app.modules.transmission.transmission import Transmission
|
||||
from app.schemas import TransferInfo, TransferTorrent, DownloadingTorrent
|
||||
from app.schemas.types import TorrentStatus
|
||||
from app.utils.string import StringUtils
|
||||
from app.utils.system import SystemUtils
|
||||
|
||||
|
||||
class TransmissionModule(_ModuleBase):
|
||||
@ -148,6 +150,12 @@ class TransmissionModule(_ModuleBase):
|
||||
if settings.TRANSFER_TYPE == "move":
|
||||
if self.remove_torrents(hashs):
|
||||
logger.info(f"移动模式删除种子成功:{hashs} ")
|
||||
# 删除残留文件
|
||||
if transinfo.path and transinfo.path.exists():
|
||||
files = SystemUtils.list_files_with_extensions(transinfo.path, settings.RMT_MEDIAEXT)
|
||||
if not files:
|
||||
logger.warn(f"删除残留文件夹:{transinfo.path}")
|
||||
shutil.rmtree(transinfo.path, ignore_errors=True)
|
||||
|
||||
def remove_torrents(self, hashs: Union[str, list]) -> bool:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user