mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-05-12 02:56:13 +08:00
3
.gitignore
vendored
3
.gitignore
vendored
@@ -172,7 +172,7 @@ cython_debug/
|
||||
|
||||
/src/module/conf/config_dev.ini
|
||||
|
||||
test.*
|
||||
|
||||
.run
|
||||
/backend/src/templates/
|
||||
/backend/src/config/
|
||||
@@ -190,6 +190,7 @@ lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
webui/.vite/deps/*
|
||||
dist.zip
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
@@ -8,5 +8,6 @@ TMDB_API = "32b19d6a05b512190a056fa4e747cbbc"
|
||||
DATA_PATH = "sqlite:///data/data.db"
|
||||
LEGACY_DATA_PATH = Path("data/data.json")
|
||||
VERSION_PATH = Path("config/version.info")
|
||||
POSTERS_PATH = Path("data/posters")
|
||||
|
||||
PLATFORM = "Windows" if "\\" in settings.downloader.path else "Unix"
|
||||
|
||||
@@ -53,8 +53,9 @@ class SeasonCollector(DownloadClient):
|
||||
engine.add_rss(
|
||||
rss_link=data.rss_link, name=data.official_title, aggregate=False
|
||||
)
|
||||
result = engine.download_bangumi(data)
|
||||
engine.bangumi.add(data)
|
||||
return engine.download_bangumi(data)
|
||||
return result
|
||||
|
||||
|
||||
def eps_complete():
|
||||
|
||||
@@ -40,19 +40,16 @@ class TorrentManager(Database):
|
||||
data = self.bangumi.search_id(int(_id))
|
||||
if isinstance(data, Bangumi):
|
||||
with DownloadClient() as client:
|
||||
# client.remove_rule(data.rule_name)
|
||||
# client.remove_rss_feed(data.official_title)
|
||||
self.rss.delete(data.official_title)
|
||||
self.bangumi.delete_one(int(_id))
|
||||
if file:
|
||||
torrent_message = self.delete_torrents(data, client)
|
||||
return torrent_message
|
||||
logger.info(f"[Manager] Delete rule for {data.official_title}")
|
||||
return ResponseModel(
|
||||
status_code=200,
|
||||
status=True,
|
||||
msg_en=f"Delete rule for {data.official_title}",
|
||||
msg_zh=f"删除 {data.official_title} 规则",
|
||||
msg_en=f"Delete rule for {data.official_title}. {torrent_message.msg_en if file else ''}",
|
||||
msg_zh=f"删除 {data.official_title} 规则。{torrent_message.msg_zh if file else ''}",
|
||||
)
|
||||
else:
|
||||
return ResponseModel(
|
||||
|
||||
@@ -26,13 +26,12 @@ class TelegramNotification(RequestContent):
|
||||
data = {
|
||||
"chat_id": self.chat_id,
|
||||
"caption": text,
|
||||
"text": text,
|
||||
"disable_notification": True,
|
||||
}
|
||||
photo = load_image(notify.poster_path)
|
||||
if photo:
|
||||
resp = self.post_files(
|
||||
self.photo_url, data, files={"photo": photo}
|
||||
)
|
||||
resp = self.post_files(self.photo_url, data, files={"photo": photo})
|
||||
else:
|
||||
resp = self.post_data(self.message_url, data)
|
||||
logger.debug(f"Telegram notification: {resp.status_code}")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import re
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from urllib3.util import parse_url
|
||||
|
||||
@@ -14,6 +16,7 @@ def mikan_parser(homepage: str):
|
||||
official_title = soup.select_one(
|
||||
'p.bangumi-title a[href^="/Home/Bangumi/"]'
|
||||
).text
|
||||
official_title = re.sub(r"第.*季", "", official_title)
|
||||
if poster_div:
|
||||
poster_path = poster_div.split("url('")[1].split("')")[0]
|
||||
img = req.get_content(f"https://{root_path}{poster_path}")
|
||||
|
||||
@@ -82,16 +82,14 @@ class RSSAnalyser(TitleParser):
|
||||
|
||||
def link_to_data(self, rss: RSSItem) -> Bangumi | ResponseModel:
|
||||
torrents = self.get_rss_torrents(rss.url, False)
|
||||
try:
|
||||
for torrent in torrents:
|
||||
data = self.torrent_to_data(torrent, rss)
|
||||
if data:
|
||||
return data
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
return ResponseModel(
|
||||
status=False,
|
||||
status_code=406,
|
||||
msg_en="No new title has been found.",
|
||||
msg_zh="没有找到新的番剧。",
|
||||
)
|
||||
for torrent in torrents:
|
||||
data = self.torrent_to_data(torrent, rss)
|
||||
if data:
|
||||
return data
|
||||
else:
|
||||
return ResponseModel(
|
||||
status=False,
|
||||
status_code=406,
|
||||
msg_en="Cannot parse this link.",
|
||||
msg_zh="无法解析此链接。",
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
|
||||
from module.rss import RSSEngine
|
||||
from module.conf import POSTERS_PATH
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -15,3 +16,4 @@ def first_run():
|
||||
with RSSEngine() as engine:
|
||||
engine.create_table()
|
||||
engine.user.add_default_user()
|
||||
POSTERS_PATH.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user