增加线程启停

This commit is contained in:
EstrellaXD
2023-05-09 23:17:09 +08:00
parent bfba4d1dda
commit f3c2aeded8
4 changed files with 115 additions and 59 deletions

View File

@@ -0,0 +1,40 @@
logging_config = {
"version": 1,
"disable_existing_loggers": False,
"loggers": {
"uvicorn.error": {
"level": "INFO",
"handlers": ["default"],
"propagate": True,
},
"uvicorn.access": {
"level": "INFO",
"handlers": ["access"],
"propagate": True,
},
},
"handlers": {
"default": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "default",
"stream": "ext://sys.stderr",
},
"access": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "access",
"stream": "ext://sys.stdout",
},
},
"formatters": {
"default": {
"format": "[%(asctime)s] %(levelname)s: %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S",
},
"access": {
"format": "[%(asctime)s] %(levelname)s: %(client_addr)s - \"%(request_line)s\" %(status_code)s",
"datefmt": "%Y-%m-%d %H:%M:%S",
},
},
}

View File

@@ -17,20 +17,20 @@ logger = logging.getLogger(__name__)
class APIProcess:
def __init__(self, settings: Config):
self._rss_analyser = RSSAnalyser(settings)
self._client = DownloadClient(settings)
self._rss_analyser = RSSAnalyser()
self._client = DownloadClient()
self._full_season_get = FullSeasonGet(settings)
self._custom_url = settings.rss_parser.custom_url
def link_process(self, link):
return self._rss_analyser.rss_to_data(link, _filter=False)
return self._rss_analyser.rss_to_data(link)
@api_failed
def download_collection(self, link):
if not self._client.authed:
self._client.auth()
data = self.link_process(link)
self._full_season_get.download_collection(data, link, self._client)
self._full_season_get.download_collection(data, link)
return data
@api_failed

View File

@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
class FullSeasonGet(DownloadClient):
def __init__(self, settings: Config):
super().__init__(settings)
super().__init__()
self.SEARCH_KEY = [
"group",
"title_raw",