mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix
This commit is contained in:
@@ -135,8 +135,8 @@ def refresh_cache(_: User = Depends(get_current_active_superuser)):
|
|||||||
|
|
||||||
@router.post("/cache/reidentify/{domain}/{torrent_hash}", summary="重新识别种子", response_model=schemas.Response)
|
@router.post("/cache/reidentify/{domain}/{torrent_hash}", summary="重新识别种子", response_model=schemas.Response)
|
||||||
async def reidentify_cache(domain: str, torrent_hash: str,
|
async def reidentify_cache(domain: str, torrent_hash: str,
|
||||||
tmdbid: Optional[int] = None, doubanid: Optional[str] = None,
|
tmdbid: Optional[int] = None, doubanid: Optional[str] = None,
|
||||||
_: User = Depends(get_current_active_superuser_async)):
|
_: User = Depends(get_current_active_superuser_async)):
|
||||||
"""
|
"""
|
||||||
重新识别指定的种子
|
重新识别指定的种子
|
||||||
:param domain: 站点域名
|
:param domain: 站点域名
|
||||||
|
|||||||
@@ -501,7 +501,8 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
# 获取整理屏蔽词
|
# 获取整理屏蔽词
|
||||||
transfer_exclude_words = SystemConfigOper().get(SystemConfigKey.TransferExcludeWords)
|
transfer_exclude_words = SystemConfigOper().get(SystemConfigKey.TransferExcludeWords)
|
||||||
for t in tasks:
|
for t in tasks:
|
||||||
if t.download_hash and self._can_delete_torrent(t.download_hash, t.downloader, transfer_exclude_words):
|
if t.download_hash and self._can_delete_torrent(t.download_hash, t.downloader,
|
||||||
|
transfer_exclude_words):
|
||||||
if self.remove_torrents(t.download_hash, downloader=t.downloader):
|
if self.remove_torrents(t.download_hash, downloader=t.downloader):
|
||||||
logger.info(f"移动模式删除种子成功:{t.download_hash}")
|
logger.info(f"移动模式删除种子成功:{t.download_hash}")
|
||||||
if t.fileitem:
|
if t.fileitem:
|
||||||
@@ -1435,7 +1436,6 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _can_delete_torrent(self, download_hash: str, downloader: str, transfer_exclude_words) -> bool:
|
def _can_delete_torrent(self, download_hash: str, downloader: str, transfer_exclude_words) -> bool:
|
||||||
"""
|
"""
|
||||||
检查是否可以删除种子文件
|
检查是否可以删除种子文件
|
||||||
@@ -1468,11 +1468,11 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
file_path = save_path / file.name
|
file_path = save_path / file.name
|
||||||
# 如果存在未被屏蔽的媒体文件,则不删除种子
|
# 如果存在未被屏蔽的媒体文件,则不删除种子
|
||||||
if (
|
if (
|
||||||
file_path.suffix in self.all_exts
|
file_path.suffix in self.all_exts
|
||||||
and not self._is_blocked_by_exclude_words(
|
and not self._is_blocked_by_exclude_words(
|
||||||
str(file_path), transfer_exclude_words
|
str(file_path), transfer_exclude_words
|
||||||
)
|
)
|
||||||
and file_path.exists()
|
and file_path.exists()
|
||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -483,7 +483,7 @@ class MediaInfo:
|
|||||||
continue
|
continue
|
||||||
if current_value is None:
|
if current_value is None:
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
elif type(current_value) == type(value):
|
elif type(current_value) is type(value):
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
def set_douban_info(self, info: dict):
|
def set_douban_info(self, info: dict):
|
||||||
@@ -624,7 +624,7 @@ class MediaInfo:
|
|||||||
continue
|
continue
|
||||||
if current_value is None:
|
if current_value is None:
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
elif type(current_value) == type(value):
|
elif type(current_value) is type(value):
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
def set_bangumi_info(self, info: dict):
|
def set_bangumi_info(self, info: dict):
|
||||||
|
|||||||
+13
-10
@@ -1,13 +1,13 @@
|
|||||||
import importlib
|
import importlib
|
||||||
|
import io
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
import site
|
import site
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import zipfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Tuple, Set, Callable, Awaitable
|
from typing import Dict, List, Optional, Tuple, Set, Callable, Awaitable
|
||||||
import zipfile
|
|
||||||
import io
|
|
||||||
|
|
||||||
import aiofiles
|
import aiofiles
|
||||||
import aioshutil
|
import aioshutil
|
||||||
@@ -248,6 +248,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
return False, f"未在插件清单中找到 {pid} 的版本号,无法进行 Release 安装"
|
return False, f"未在插件清单中找到 {pid} 的版本号,无法进行 Release 安装"
|
||||||
# 拼接 release_tag
|
# 拼接 release_tag
|
||||||
release_tag = f"{pid}_v{plugin_version}"
|
release_tag = f"{pid}_v{plugin_version}"
|
||||||
|
|
||||||
# 使用 release 进行安装
|
# 使用 release 进行安装
|
||||||
def prepare_release() -> Tuple[bool, str]:
|
def prepare_release() -> Tuple[bool, str]:
|
||||||
return self.__install_from_release(
|
return self.__install_from_release(
|
||||||
@@ -533,12 +534,12 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def __get_plugin_meta(self, pid: str, repo_url: str,
|
def __get_plugin_meta(self, pid: str, repo_url: str,
|
||||||
package_version: Optional[str]) -> dict:
|
package_version: Optional[str]) -> dict:
|
||||||
try:
|
try:
|
||||||
plugins = (
|
plugins = (
|
||||||
self.get_plugins(repo_url) if not package_version
|
self.get_plugins(repo_url) if not package_version
|
||||||
else self.get_plugins(repo_url, package_version)
|
else self.get_plugins(repo_url, package_version)
|
||||||
) or {}
|
) or {}
|
||||||
meta = plugins.get(pid)
|
meta = plugins.get(pid)
|
||||||
return meta if isinstance(meta, dict) else {}
|
return meta if isinstance(meta, dict) else {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -1393,6 +1394,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
return False, f"未在插件清单中找到 {pid} 的版本号,无法进行 Release 安装"
|
return False, f"未在插件清单中找到 {pid} 的版本号,无法进行 Release 安装"
|
||||||
# 拼接 release_tag
|
# 拼接 release_tag
|
||||||
release_tag = f"{pid}_v{plugin_version}"
|
release_tag = f"{pid}_v{plugin_version}"
|
||||||
|
|
||||||
# 使用 release 进行安装
|
# 使用 release 进行安装
|
||||||
async def prepare_release() -> Tuple[bool, str]:
|
async def prepare_release() -> Tuple[bool, str]:
|
||||||
return await self.__async_install_from_release(
|
return await self.__async_install_from_release(
|
||||||
@@ -1411,9 +1413,9 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
package_version: Optional[str]) -> dict:
|
package_version: Optional[str]) -> dict:
|
||||||
try:
|
try:
|
||||||
plugins = (
|
plugins = (
|
||||||
await self.async_get_plugins(repo_url) if not package_version
|
await self.async_get_plugins(repo_url) if not package_version
|
||||||
else await self.async_get_plugins(repo_url, package_version)
|
else await self.async_get_plugins(repo_url, package_version)
|
||||||
) or {}
|
) or {}
|
||||||
meta = plugins.get(pid)
|
meta = plugins.get(pid)
|
||||||
return meta if isinstance(meta, dict) else {}
|
return meta if isinstance(meta, dict) else {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -1528,7 +1530,8 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
logger.error(f"解析 Release 信息失败:{e}")
|
logger.error(f"解析 Release 信息失败:{e}")
|
||||||
return False, f"解析 Release 信息失败:{e}"
|
return False, f"解析 Release 信息失败:{e}"
|
||||||
|
|
||||||
res = await self.__async_request_with_fallback(download_url, headers=settings.REPO_GITHUB_HEADERS(repo=user_repo))
|
res = await self.__async_request_with_fallback(download_url,
|
||||||
|
headers=settings.REPO_GITHUB_HEADERS(repo=user_repo))
|
||||||
if res is None or res.status_code != 200:
|
if res is None or res.status_code != 200:
|
||||||
return False, f"下载资产失败:{res.status_code if res else '连接失败'}"
|
return False, f"下载资产失败:{res.status_code if res else '连接失败'}"
|
||||||
|
|
||||||
|
|||||||
@@ -282,9 +282,8 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
|
|||||||
episodes=episodes
|
episodes=episodes
|
||||||
) for season, episodes in seasoninfo.items()]
|
) for season, episodes in seasoninfo.items()]
|
||||||
|
|
||||||
def mediaserver_playing(self, server: str,
|
def mediaserver_playing(self, server: str, count: Optional[int] = 20,
|
||||||
count: Optional[int] = 20, username: Optional[str] = None) -> List[
|
username: Optional[str] = None) -> List[schemas.MediaServerPlayItem]:
|
||||||
schemas.MediaServerPlayItem]:
|
|
||||||
"""
|
"""
|
||||||
获取媒体服务器正在播放信息
|
获取媒体服务器正在播放信息
|
||||||
"""
|
"""
|
||||||
@@ -302,9 +301,8 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
|
|||||||
return None
|
return None
|
||||||
return server_obj.get_play_url(item_id)
|
return server_obj.get_play_url(item_id)
|
||||||
|
|
||||||
def mediaserver_latest(self, server: Optional[str] = None,
|
def mediaserver_latest(self, server: Optional[str] = None, count: Optional[int] = 20,
|
||||||
count: Optional[int] = 20, username: Optional[str] = None) -> List[
|
username: Optional[str] = None) -> List[schemas.MediaServerPlayItem]:
|
||||||
schemas.MediaServerPlayItem]:
|
|
||||||
"""
|
"""
|
||||||
获取媒体服务器最新入库条目
|
获取媒体服务器最新入库条目
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class Emby:
|
|||||||
image=image,
|
image=image,
|
||||||
link=f'{self._playhost or self._host}web/index.html'
|
link=f'{self._playhost or self._host}web/index.html'
|
||||||
f'#!/videos?serverId={self.serverid}&parentId={library.get("Id")}',
|
f'#!/videos?serverId={self.serverid}&parentId={library.get("Id")}',
|
||||||
server_type= "emby"
|
server_type="emby"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return libraries
|
return libraries
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class CategoryHelper(metaclass=WeakSingleton):
|
|||||||
continue
|
continue
|
||||||
elif attr == "production_countries":
|
elif attr == "production_countries":
|
||||||
# 制片国家
|
# 制片国家
|
||||||
info_values = [str(val.get("iso_3166_1")).upper() for val in info_value] # type: ignore
|
info_values = [str(val.get("iso_3166_1")).upper() for val in info_value] # type: ignore
|
||||||
else:
|
else:
|
||||||
if isinstance(info_value, list):
|
if isinstance(info_value, list):
|
||||||
info_values = [str(val).upper() for val in info_value]
|
info_values = [str(val).upper() for val in info_value]
|
||||||
|
|||||||
@@ -402,7 +402,8 @@ class TmdbApi:
|
|||||||
if match:
|
if match:
|
||||||
try:
|
try:
|
||||||
return int(match.group(1))
|
return int(match.group(1))
|
||||||
except Exception:
|
except Exception as err:
|
||||||
|
logger.debug(f"解析TMDBID失败:{str(err)} - {traceback.format_exc()}")
|
||||||
return None
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -832,7 +833,6 @@ class TmdbApi:
|
|||||||
return None
|
return None
|
||||||
# dict[地区:分级]
|
# dict[地区:分级]
|
||||||
ratings = {}
|
ratings = {}
|
||||||
results = []
|
|
||||||
if results := (tmdb_info.get("release_dates") or {}).get("results"):
|
if results := (tmdb_info.get("release_dates") or {}).get("results"):
|
||||||
"""
|
"""
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user