fix 数据库会话管理

This commit is contained in:
jxxghp
2023-08-16 10:22:45 +08:00
parent b086bbf015
commit da93328d50
29 changed files with 255 additions and 172 deletions

View File

@@ -4,6 +4,8 @@ from datetime import datetime
from typing import Dict
from typing import List, Optional
from sqlalchemy.orm import Session
from app.chain import ChainBase
from app.core.context import Context
from app.core.context import MediaInfo, TorrentInfo
@@ -23,11 +25,11 @@ class SearchChain(ChainBase):
站点资源搜索处理链
"""
def __init__(self):
super().__init__()
def __init__(self, db: Session = None):
super().__init__(db)
self.siteshelper = SitesHelper()
self.progress = ProgressHelper()
self.systemconfig = SystemConfigOper()
self.systemconfig = SystemConfigOper(self._db)
self.torrenthelper = TorrentHelper()
def search_by_tmdbid(self, tmdbid: int, mtype: MediaType = None) -> List[Context]: