mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-09 09:26:55 +08:00
Revert "Merge pull request #5573 from wikrin/refactor-static-methods-conversion"
This reverts commitb8fc20b981, reversing changes made toe09cfc6704.
This commit is contained in:
@@ -145,8 +145,7 @@ class TorrentHelper:
|
||||
self.add_invalid(url)
|
||||
return cache_path, None, "", [], f"下载种子出错,状态码:{req.status_code}"
|
||||
|
||||
@staticmethod
|
||||
def get_torrent_info(torrent_path: Path) -> Tuple[str, List[str]]:
|
||||
def get_torrent_info(self, torrent_path: Path) -> Tuple[str, List[str]]:
|
||||
"""
|
||||
获取种子文件的文件夹名和文件清单
|
||||
:param torrent_path: 种子文件路径
|
||||
@@ -157,7 +156,7 @@ class TorrentHelper:
|
||||
try:
|
||||
torrentinfo = Torrent.from_file(torrent_path)
|
||||
# 获取文件清单
|
||||
return TorrentHelper.get_fileinfo_from_torrent(torrentinfo)
|
||||
return self.get_fileinfo_from_torrent(torrentinfo)
|
||||
except Exception as err:
|
||||
logger.error(f"种子文件解析失败:{str(err)}")
|
||||
return "", []
|
||||
@@ -193,8 +192,7 @@ class TorrentHelper:
|
||||
logger.debug(f"解析种子:{torrent.name} => 目录:{folder_name},文件清单:{file_list}")
|
||||
return folder_name, file_list
|
||||
|
||||
@staticmethod
|
||||
def get_fileinfo_from_torrent_content(torrent_content: Union[str, bytes]) -> Tuple[str, List[str]]:
|
||||
def get_fileinfo_from_torrent_content(self, torrent_content: Union[str, bytes]) -> Tuple[str, List[str]]:
|
||||
"""
|
||||
从种子内容中获取文件夹名和文件清单
|
||||
:param torrent_content: 种子内容
|
||||
@@ -212,7 +210,7 @@ class TorrentHelper:
|
||||
# 解析种子内容
|
||||
torrentinfo = Torrent.from_string(torrent_content)
|
||||
# 获取文件清单
|
||||
return TorrentHelper.get_fileinfo_from_torrent(torrentinfo)
|
||||
return self.get_fileinfo_from_torrent(torrentinfo)
|
||||
except Exception as err:
|
||||
logger.error(f"种子内容解析失败:{str(err)}")
|
||||
return "", []
|
||||
@@ -294,8 +292,7 @@ class TorrentHelper:
|
||||
# 排序
|
||||
return sorted(torrent_list, key=lambda x: get_sort_str(x), reverse=True)
|
||||
|
||||
@staticmethod
|
||||
def sort_group_torrents(torrent_list: List[Context]) -> List[Context]:
|
||||
def sort_group_torrents(self, torrent_list: List[Context]) -> List[Context]:
|
||||
"""
|
||||
对媒体信息进行排序、去重
|
||||
"""
|
||||
@@ -303,7 +300,7 @@ class TorrentHelper:
|
||||
return []
|
||||
|
||||
# 排序
|
||||
torrent_list = TorrentHelper.sort_torrents(torrent_list)
|
||||
torrent_list = self.sort_torrents(torrent_list)
|
||||
|
||||
# 控重
|
||||
result = []
|
||||
|
||||
Reference in New Issue
Block a user