mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-07-17 04:01:01 +08:00
@@ -58,9 +58,9 @@ def remove_rule(bangumi_id: str):
|
||||
|
||||
@router.post("/api/v1/collection", tags=["download"])
|
||||
async def collection(link: RssLink):
|
||||
response = api_func.download_collection(link.rss_link).dict()
|
||||
response = api_func.download_collection(link.rss_link)
|
||||
if response:
|
||||
return response
|
||||
return response.dict()
|
||||
else:
|
||||
return {"status": "Failed to parse link"}
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ class DownloadClient:
|
||||
self.client.rss_set_rule(rule_name=f"{rule_name} S{season}", rule_def=rule)
|
||||
logger.info(f"Add {official_name} Season {season}")
|
||||
|
||||
def rss_feed(self, rss_link):
|
||||
def rss_feed(self, rss_link, item_path="Mikan_RSS"):
|
||||
# TODO: 定时刷新 RSS
|
||||
if self.client.get_rss_info() == rss_link:
|
||||
if self.client.get_rss_info(rss_link):
|
||||
logger.info("RSS Already exists.")
|
||||
else:
|
||||
logger.info("No feed exists, start adding feed.")
|
||||
|
||||
@@ -66,17 +66,18 @@ class QbDownloader:
|
||||
def torrents_rename_file(self, torrent_hash, old_path, new_path):
|
||||
self._client.torrents_rename_file(torrent_hash=torrent_hash, old_path=old_path, new_path=new_path)
|
||||
|
||||
def get_rss_info(self):
|
||||
item = self._client.rss_items().get("Mikan_RSS")
|
||||
if item is not None:
|
||||
return item.url
|
||||
else:
|
||||
return None
|
||||
def get_rss_info(self, url) -> str | None:
|
||||
items = self._client.rss_items()
|
||||
for item in items.items():
|
||||
if item[1].url == url:
|
||||
return item[0]
|
||||
return None
|
||||
|
||||
def rss_add_feed(self, url, item_path):
|
||||
try:
|
||||
if self.get_rss_info() is not None:
|
||||
self.rss_remove_item(item_path)
|
||||
path = self.get_rss_info(url)
|
||||
if path:
|
||||
self.rss_remove_item(path)
|
||||
self._client.rss_add_feed(url, item_path)
|
||||
except Conflict409Error:
|
||||
logger.exception("RSS Exist.")
|
||||
|
||||
@@ -39,7 +39,7 @@ class Renamer:
|
||||
for f in info.files:
|
||||
file_name = f.name
|
||||
suffix = os.path.splitext(file_name)[-1]
|
||||
if suffix in suffix_list:
|
||||
if suffix.lower() in suffix_list:
|
||||
file_list.append(file_name)
|
||||
return file_list
|
||||
|
||||
|
||||
Reference in New Issue
Block a user