mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-05-11 18:45:58 +08:00
make DownloadClient mother class for all need to use that
This commit is contained in:
@@ -5,12 +5,14 @@ from module.network import RequestContent
|
||||
from module.parser import TitleParser
|
||||
from module.models import BangumiData, Config
|
||||
from module.database import DataOperator
|
||||
from module.core import DownloadClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RSSAnalyser:
|
||||
class RSSAnalyser(DownloadClient):
|
||||
def __init__(self, settings: Config):
|
||||
super().__init__(settings)
|
||||
self._title_analyser = TitleParser()
|
||||
self.settings = settings
|
||||
|
||||
@@ -27,12 +29,13 @@ class RSSAnalyser:
|
||||
raw=raw_title, _id=_id, settings=self.settings
|
||||
)
|
||||
if data is not None and op.match_title(data.official_title) is None:
|
||||
op.insert(data)
|
||||
self.set_rule(data, rss_link)
|
||||
data_list.append(data)
|
||||
_id += 1
|
||||
op.insert_list(data_list)
|
||||
return data_list
|
||||
|
||||
def rss_to_data(self, url, _filter: bool = True) -> BangumiData:
|
||||
def rss_to_data(self, url, _filter: bool = True):
|
||||
with RequestContent() as req:
|
||||
rss_torrents = req.get_torrents(url, _filter)
|
||||
for torrent in rss_torrents:
|
||||
@@ -40,7 +43,7 @@ class RSSAnalyser:
|
||||
data = self._title_analyser.raw_parser(
|
||||
torrent.name, settings=self.settings
|
||||
)
|
||||
return data
|
||||
self.set_rule(data, url)
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user