mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-09 01:16:50 +08:00
Optimize agent tool async blocking paths
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List, Optional
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from app.db import DbOper
|
||||
from app.db.models.downloadhistory import DownloadHistory, DownloadFiles
|
||||
@@ -23,6 +23,17 @@ class DownloadHistoryOper(DbOper):
|
||||
"""
|
||||
return DownloadHistory.get_by_hash(self._db, download_hash)
|
||||
|
||||
def get_by_hashes(self, download_hashes: List[str]) -> Dict[str, DownloadHistory]:
|
||||
"""
|
||||
批量按 Hash 查询下载记录,并返回以 Hash 为键的映射。
|
||||
"""
|
||||
histories = DownloadHistory.get_by_hashes(self._db, download_hashes)
|
||||
return {
|
||||
history.download_hash: history
|
||||
for history in histories
|
||||
if history and history.download_hash
|
||||
}
|
||||
|
||||
def get_by_mediaid(self, tmdbid: int, doubanid: str) -> List[DownloadHistory]:
|
||||
"""
|
||||
按媒体ID查询下载记录
|
||||
|
||||
Reference in New Issue
Block a user