fix 删种

This commit is contained in:
thsrite 2023-10-13 11:45:18 +08:00
parent c36c94971e
commit 4eebaa5d75

View File

@ -1013,40 +1013,42 @@ class MediaSyncDel(_PluginBase):
if not isinstance(torrents, list): if not isinstance(torrents, list):
torrents = [torrents] torrents = [torrents]
# 删除辅种历史中与本下载器相同的辅种记录 # 删除辅种历史
if str(downloader) == str(download): for torrent in torrents:
for torrent in torrents: handle_cnt += 1
handle_cnt += 1 if str(download) == "qbittorrent":
if str(download) == "qbittorrent": # 删除辅种
# 删除辅种 if action_flag == "del":
if action_flag == "del": logger.info(f"删除辅种:{downloader} - {torrent}")
logger.info(f"删除辅种:{downloader} - {torrent}") self.qb.delete_torrents(delete_file=True,
self.qb.delete_torrents(delete_file=True, ids=torrent)
ids=torrent) # 暂停辅种
# 暂停辅种 if action_flag == "stop":
if action_flag == "stop": self.qb.stop_torrents(torrent)
self.qb.stop_torrents(torrent) logger.info(f"辅种:{downloader} - {torrent} 暂停")
logger.info(f"辅种:{downloader} - {torrent} 暂停") else:
else: # 删除辅种
# 删除辅种 if action_flag == "del":
if action_flag == "del": logger.info(f"删除辅种:{downloader} - {torrent}")
logger.info(f"删除辅种:{downloader} - {torrent}") self.tr.delete_torrents(delete_file=True,
self.tr.delete_torrents(delete_file=True, ids=torrent)
ids=torrent) # 暂停辅种
# 暂停辅种 if action_flag == "stop":
if action_flag == "stop": self.tr.stop_torrents(torrent)
self.tr.stop_torrents(torrent) logger.info(f"辅种:{downloader} - {torrent} 暂停")
logger.info(f"辅种:{downloader} - {torrent} 暂停") # 删除本下载器辅种历史
# 删除本下载器辅种历史 if action_flag == "del":
if action_flag == "del": del history
del history break
break
# 更新辅种历史 # 更新辅种历史
self.save_data(key=history_key, if seed_history:
value=seed_history, self.save_data(key=history_key,
plugin_id=plugin_id) value=seed_history,
plugin_id=plugin_id)
else:
self.del_data(key=history_key,
plugin_id=plugin_id)
return handle_cnt return handle_cnt
@staticmethod @staticmethod