mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +08:00
Merge pull request #5089 from wikrin/fix
This commit is contained in:
@@ -14,7 +14,7 @@ from app.db.models import User
|
|||||||
from app.db.models.downloadhistory import DownloadHistory
|
from app.db.models.downloadhistory import DownloadHistory
|
||||||
from app.db.models.transferhistory import TransferHistory
|
from app.db.models.transferhistory import TransferHistory
|
||||||
from app.db.user_oper import get_current_active_superuser_async, get_current_active_superuser
|
from app.db.user_oper import get_current_active_superuser_async, get_current_active_superuser
|
||||||
from app.schemas.types import EventType, MediaType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ async def transfer_history(title: Optional[str] = None,
|
|||||||
|
|
||||||
return schemas.Response(success=True,
|
return schemas.Response(success=True,
|
||||||
data={
|
data={
|
||||||
"list": result,
|
"list": [item.to_dict() for item in result],
|
||||||
"total": total,
|
"total": total,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1116,6 +1116,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
file_meta=file_meta)
|
file_meta=file_meta)
|
||||||
if begin_ep is not None:
|
if begin_ep is not None:
|
||||||
file_meta.begin_episode = begin_ep
|
file_meta.begin_episode = begin_ep
|
||||||
|
if part is not None:
|
||||||
file_meta.part = part
|
file_meta.part = part
|
||||||
if end_ep is not None:
|
if end_ep is not None:
|
||||||
file_meta.end_episode = end_ep
|
file_meta.end_episode = end_ep
|
||||||
@@ -1125,10 +1126,10 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
downloadhis = DownloadHistoryOper()
|
downloadhis = DownloadHistoryOper()
|
||||||
if bluray_dir:
|
if bluray_dir:
|
||||||
# 蓝光原盘,按目录名查询
|
# 蓝光原盘,按目录名查询
|
||||||
download_history = downloadhis.get_by_path(str(file_path))
|
download_history = downloadhis.get_by_path(file_path.as_posix())
|
||||||
else:
|
else:
|
||||||
# 按文件全路径查询
|
# 按文件全路径查询
|
||||||
download_file = downloadhis.get_file_by_fullpath(str(file_path))
|
download_file = downloadhis.get_file_by_fullpath(file_path.as_posix())
|
||||||
if download_file:
|
if download_file:
|
||||||
download_history = downloadhis.get_by_hash(download_file.download_hash)
|
download_history = downloadhis.get_by_hash(download_file.download_hash)
|
||||||
|
|
||||||
@@ -1441,7 +1442,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
|
|
||||||
for keyword in exclude_words:
|
for keyword in exclude_words:
|
||||||
if keyword and re.search(r"%s" % keyword, file_path, re.IGNORECASE):
|
if keyword and re.search(r"%s" % keyword, file_path, re.IGNORECASE):
|
||||||
logger.debug(f"{file_path} 命中屏蔽词 {keyword}")
|
logger.warn(f"{file_path} 命中屏蔽词 {keyword}")
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -1477,7 +1478,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
file_path = save_path / file.name
|
file_path = save_path / file.name
|
||||||
# 如果存在未被屏蔽的媒体文件,则不删除种子
|
# 如果存在未被屏蔽的媒体文件,则不删除种子
|
||||||
if (file_path.suffix in self.all_exts
|
if (file_path.suffix in self.all_exts
|
||||||
and not self._is_blocked_by_exclude_words(str(file_path), transfer_exclude_words)
|
and not self._is_blocked_by_exclude_words(file_path.as_posix(), transfer_exclude_words)
|
||||||
and file_path.exists()):
|
and file_path.exists()):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -621,7 +621,7 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel):
|
|||||||
return False, f"配置项 '{key}' 不存在"
|
return False, f"配置项 '{key}' 不存在"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
field = self.__fields__[key]
|
field = Settings.model_fields[key]
|
||||||
original_value = getattr(self, key)
|
original_value = getattr(self, key)
|
||||||
if field.name == "API_TOKEN":
|
if field.name == "API_TOKEN":
|
||||||
converted_value, needs_update = self.validate_api_token(value, original_value)
|
converted_value, needs_update = self.validate_api_token(value, original_value)
|
||||||
|
|||||||
+1
-1
@@ -257,7 +257,7 @@ class MediaInfo:
|
|||||||
# 评价数量
|
# 评价数量
|
||||||
vote_count: int = None
|
vote_count: int = None
|
||||||
# 流行度
|
# 流行度
|
||||||
popularity: int = None
|
popularity: float = None
|
||||||
# 时长
|
# 时长
|
||||||
runtime: int = None
|
runtime: int = None
|
||||||
# 下一集
|
# 下一集
|
||||||
|
|||||||
@@ -367,7 +367,6 @@ class TemplateHelper(metaclass=SingletonClass):
|
|||||||
return rendered
|
return rendered
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"模板处理失败: {str(e)}")
|
|
||||||
raise ValueError(f"模板处理失败: {str(e)}") from e
|
raise ValueError(f"模板处理失败: {str(e)}") from e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ class Emby:
|
|||||||
item_type=item.get("Type"),
|
item_type=item.get("Type"),
|
||||||
title=item.get("Name"),
|
title=item.get("Name"),
|
||||||
original_title=item.get("OriginalTitle"),
|
original_title=item.get("OriginalTitle"),
|
||||||
year=item.get("ProductionYear"),
|
year=str(item.get("ProductionYear")),
|
||||||
tmdbid=int(tmdbid) if tmdbid else None,
|
tmdbid=int(tmdbid) if tmdbid else None,
|
||||||
imdbid=item.get("ProviderIds", {}).get("Imdb"),
|
imdbid=item.get("ProviderIds", {}).get("Imdb"),
|
||||||
tvdbid=item.get("ProviderIds", {}).get("Tvdb"),
|
tvdbid=item.get("ProviderIds", {}).get("Tvdb"),
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ class Jellyfin:
|
|||||||
item_type=item.get("Type"),
|
item_type=item.get("Type"),
|
||||||
title=item.get("Name"),
|
title=item.get("Name"),
|
||||||
original_title=item.get("OriginalTitle"),
|
original_title=item.get("OriginalTitle"),
|
||||||
year=item.get("ProductionYear"),
|
year=str(item.get("ProductionYear")),
|
||||||
tmdbid=int(tmdbid) if tmdbid else None,
|
tmdbid=int(tmdbid) if tmdbid else None,
|
||||||
imdbid=item.get("ProviderIds", {}).get("Imdb"),
|
imdbid=item.get("ProviderIds", {}).get("Imdb"),
|
||||||
tvdbid=item.get("ProviderIds", {}).get("Tvdb"),
|
tvdbid=item.get("ProviderIds", {}).get("Tvdb"),
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ class Plex:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __get_ids(guids: List[Any]) -> dict:
|
def __get_ids(guids: List[Any]) -> dict:
|
||||||
def parse_tmdb_id(value: str) -> (bool, int):
|
def parse_tmdb_id(value: str) -> tuple[bool, int]:
|
||||||
"""尝试将TMDB ID字符串转换为整数。如果成功,返回(True, int),失败则返回(False, None)。"""
|
"""尝试将TMDB ID字符串转换为整数。如果成功,返回(True, int),失败则返回(False, None)。"""
|
||||||
try:
|
try:
|
||||||
int_value = int(value)
|
int_value = int(value)
|
||||||
@@ -509,7 +509,7 @@ class Plex:
|
|||||||
item_type=item.type,
|
item_type=item.type,
|
||||||
title=item.title,
|
title=item.title,
|
||||||
original_title=item.originalTitle,
|
original_title=item.originalTitle,
|
||||||
year=item.year,
|
year=str(item.year),
|
||||||
tmdbid=ids.get("tmdb_id"),
|
tmdbid=ids.get("tmdb_id"),
|
||||||
imdbid=ids.get("imdb_id"),
|
imdbid=ids.get("imdb_id"),
|
||||||
tvdbid=ids.get("tvdb_id"),
|
tvdbid=ids.get("tvdb_id"),
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ class TrimeMedia:
|
|||||||
item_type=item_type,
|
item_type=item_type,
|
||||||
title=item.title,
|
title=item.title,
|
||||||
original_title=item.original_title,
|
original_title=item.original_title,
|
||||||
year=year,
|
year=str(year),
|
||||||
tmdbid=item.tmdb_id,
|
tmdbid=item.tmdb_id,
|
||||||
imdbid=item.imdb_id,
|
imdbid=item.imdb_id,
|
||||||
user_state=user_state,
|
user_state=user_state,
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class MediaInfo(BaseModel):
|
|||||||
# IMDB ID
|
# IMDB ID
|
||||||
imdb_id: Optional[str] = None
|
imdb_id: Optional[str] = None
|
||||||
# TVDB ID
|
# TVDB ID
|
||||||
tvdb_id: Optional[str] = None
|
tvdb_id: Optional[int] = None
|
||||||
# 豆瓣ID
|
# 豆瓣ID
|
||||||
douban_id: Optional[str] = None
|
douban_id: Optional[str] = None
|
||||||
# Bangumi ID
|
# Bangumi ID
|
||||||
@@ -167,7 +167,7 @@ class MediaInfo(BaseModel):
|
|||||||
# 评价数量
|
# 评价数量
|
||||||
vote_count: Optional[int] = 0
|
vote_count: Optional[int] = 0
|
||||||
# 流行度
|
# 流行度
|
||||||
popularity: Optional[int] = 0
|
popularity: Optional[float] = 0.0
|
||||||
# 时长
|
# 时长
|
||||||
runtime: Optional[int] = None
|
runtime: Optional[int] = None
|
||||||
# 下一集
|
# 下一集
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Subscribe(BaseModel):
|
|||||||
# 背景图
|
# 背景图
|
||||||
backdrop: Optional[str] = None
|
backdrop: Optional[str] = None
|
||||||
# 评分
|
# 评分
|
||||||
vote: Optional[int] = 0
|
vote: Optional[float] = 0
|
||||||
# 描述
|
# 描述
|
||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
# 过滤规则
|
# 过滤规则
|
||||||
|
|||||||
Reference in New Issue
Block a user