Merge pull request #1636 from HankunYu/main

This commit is contained in:
jxxghp 2024-03-09 08:05:49 +08:00 committed by GitHub
commit bdcbb168a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,9 +119,9 @@ class Qbittorrent:
tags=tags) tags=tags)
return None if error else torrents or [] return None if error else torrents or []
def remove_torrents_tag(self, ids: Union[str, list], tag: Union[str, list]) -> bool: def delete_torrents_tag(self, ids: Union[str, list], tag: Union[str, list]) -> bool:
""" """
移除种子Tag 删除Tag
:param ids: 种子Hash列表 :param ids: 种子Hash列表
:param tag: 标签内容 :param tag: 标签内容
""" """
@ -130,10 +130,25 @@ class Qbittorrent:
try: try:
self.qbc.torrents_delete_tags(torrent_hashes=ids, tags=tag) self.qbc.torrents_delete_tags(torrent_hashes=ids, tags=tag)
return True return True
except Exception as err:
logger.error(f"删除种子Tag出错{str(err)}")
return False
def remove_torrents_tag(self, ids: Union[str, list], tag: Union[str, list]) -> bool:
"""
移除种子Tag
:param ids: 种子Hash列表
:param tag: 标签内容
"""
if not self.qbc:
return False
try:
self.qbc.torrents_remove_tags(torrent_hashes=ids, tags=tag)
return True
except Exception as err: except Exception as err:
logger.error(f"移除种子Tag出错{str(err)}") logger.error(f"移除种子Tag出错{str(err)}")
return False return False
def set_torrents_tag(self, ids: Union[str, list], tags: list): def set_torrents_tag(self, ids: Union[str, list], tags: list):
""" """
设置种子状态为已整理以及是否强制做种 设置种子状态为已整理以及是否强制做种
@ -187,7 +202,7 @@ class Qbittorrent:
if torrent_id is None: if torrent_id is None:
continue continue
else: else:
self.remove_torrents_tag(torrent_id, tags) self.delete_torrents_tag(torrent_id, tags)
break break
return torrent_id return torrent_id