Fix status bug.

Fix log level of uvicorn access.
This commit is contained in:
EstrellaXD
2023-05-11 17:30:42 +08:00
parent fb6414f2e3
commit 53482111a0
3 changed files with 12 additions and 37 deletions

View File

@@ -18,7 +18,6 @@ def check_status() -> bool:
return False
def check_downloader():
with DownloadClient() as client:
if client.authed:

View File

@@ -1,25 +0,0 @@
import re
import logging
import xml.etree.ElementTree
from typing import Tuple
from module.conf import settings
from module.utils import json_config
logger = logging.getLogger(__name__)
class RSSFilter:
def __init__(self):
self.filter_rule = json_config.load(settings.filter_rule)
def filter(self, item: xml.etree.ElementTree.Element) -> Tuple[bool, str]:
title = item.find("title").text
torrent = item.find("enclosure").attrib["url"]
download = False
for rule in self.filter_rule:
if re.search(rule["include"], title):
if not re.search(rule["exclude"], title):
download = True
logger.debug(f"{title} added")
return download, torrent

View File

@@ -1,15 +1,16 @@
from module.network import RequestContent
class BgmAPI:
def __init__(self):
self.search_url = lambda e: f"https://api.bgm.tv/search/subject/{e}?type=2"
self.info_url = lambda e: f"https://api.bgm.tv/subject/{e}"
search_url = lambda e: \
f"https://api.bgm.tv/search/subject/{e}?responseGroup=large"
def bgm_parser(title):
url = search_url(title)
with RequestContent() as req:
contents = req.get_json(url)
if contents:
return contents[0]
else:
return None
def search(self, title):
url = self.search_url(title)
with RequestContent() as req:
contents = req.get_json(url)["list"]
if contents.__len__() == 0:
return None
return contents[0]["name"], contents[0]["name_cn"]