diff --git a/src/conf/const.py b/src/conf/const.py index 6d003174..715604cc 100644 --- a/src/conf/const.py +++ b/src/conf/const.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- DEFAULT_SETTINGS = { - "version": "2.5.11", + "version": "2.5.13", "data_version": 4.0, "host_ip": "localhost:8080", "sleep_time": 7200, diff --git a/src/network/__init__.py b/src/network/__init__.py index 5c7eee44..95d7d06c 100644 --- a/src/network/__init__.py +++ b/src/network/__init__.py @@ -2,7 +2,7 @@ import re from dataclasses import dataclass from network.request import RequestURL -from .notification import PostNotification +from network.notification import PostNotification from conf import settings @@ -20,12 +20,12 @@ class RequestContent: def get_torrents(self, url: str) -> [TorrentInfo]: soup = self._req.get_content(url) torrent_titles = [item.title.string for item in soup.find_all("item")] - keep_index = [] - for idx, title in enumerate(torrent_titles): - if re.search(settings.not_contain, title) is None: - keep_index.append(idx) torrent_urls = [item.get("url") for item in soup.find_all("enclosure")] - return [TorrentInfo(torrent_titles[i], torrent_urls[i]) for i in keep_index] + torrents = [] + for title, torrent_url in zip(torrent_titles, torrent_urls): + if re.search(settings.not_contain, title) is None: + torrents.append(TorrentInfo(title, torrent_url)) + return torrents def get_torrent(self, url) -> TorrentInfo: soup = self._req.get_content(url) diff --git a/src/parser/title_parser.py b/src/parser/title_parser.py index 9184de16..0a7758b4 100644 --- a/src/parser/title_parser.py +++ b/src/parser/title_parser.py @@ -52,7 +52,7 @@ class TitleParser: "source": episode.source, "subtitle": episode.sub, "added": False, - "eps_collect": True if settings.eps_complete and episode.ep_info.number > 1 else False, + "eps_collect": True if settings.eps_complete and episode.episode > 1 else False, } logger.debug(f"RAW:{raw} >> {episode.title_en}") return data @@ -65,7 +65,7 @@ if __name__ == '__main__': from conf.const_dev import DEV_SETTINGS settings.init(DEV_SETTINGS) T = TitleParser() - raw = "[Lilith-Raws] 在地下城寻求邂逅是否搞错了什么 - 00 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]" + raw = "[Lilith-Raws] 在地下城寻求邂逅是否搞错了什么/Danmachi [无修正][01][Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]" season = int(re.search(r"\d{1,2}", "S02").group()) dict = T.return_dict(raw) print(dict)