mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 00:46:57 +08:00
add 下载历史记录
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.db import DbOper
|
||||
from app.db.models.downloadhistory import DownloadHistory
|
||||
|
||||
|
||||
class DownloadHistoryOper(DbOper):
|
||||
"""
|
||||
插件数据管理
|
||||
"""
|
||||
|
||||
def get_by_path(self, path: Path) -> Any:
|
||||
"""
|
||||
按路径查询下载记录
|
||||
:param path: 数据key
|
||||
"""
|
||||
return DownloadHistory.get_by_path(self._db, path)
|
||||
|
||||
def get_by_hash(self, download_hash: str) -> Any:
|
||||
"""
|
||||
按Hash查询下载记录
|
||||
:param download_hash: 数据key
|
||||
"""
|
||||
return DownloadHistory.get_by_hash(self._db, download_hash)
|
||||
|
||||
def add(self, **kwargs):
|
||||
"""
|
||||
新增下载历史
|
||||
"""
|
||||
downloadhistory = DownloadHistory(**kwargs)
|
||||
return downloadhistory.create(self._db)
|
||||
Reference in New Issue
Block a user