New TorrentInfo class.

This commit is contained in:
EstrellaXD
2023-05-16 22:10:20 +08:00
parent f6e08f61bc
commit e4d17ee60b
8 changed files with 62 additions and 34 deletions

View File

@@ -157,7 +157,7 @@ class BangumiDatabase(DataConnector):
return poster_link
return ""
def match_list(self, title_dict: dict, rss_link: str) -> dict:
def match_list(self, torrent_list: list, rss_link: str) -> list:
# Match title_raw in database
self._cursor.execute(
"""
@@ -166,17 +166,21 @@ class BangumiDatabase(DataConnector):
)
data = self._cursor.fetchall()
if not data:
return title_dict
return torrent_list
# Match title
for title in title_dict.copy().keys():
i = 0
while i < len(torrent_list):
torrent = torrent_list[i]
for title_raw, rss_set in data:
if title_raw in title:
if title_raw in torrent.name:
if rss_link not in rss_set:
rss_set += "," + rss_link
self.update_rss(title_raw, rss_set)
title_dict.pop(title)
torrent_list.pop(i)
break
return title_dict
else:
i += 1
return torrent_list
def not_complete(self) -> list[BangumiData]:
# Find eps_complete = False