fix: normalize MoviePilot media identifiers
这个提交存在于:
父节点
fc56e5fb78
当前提交
dcf0416307
共有 5 个文件被更改,包括 9 次插入 和 5 次删除
2
main.py
2
main.py
|
|
@ -40,7 +40,7 @@ def _media_result_chain(results: list[dict[str, object]]) -> list[object]:
|
||||||
"astrbot_plugin_moviepilot",
|
"astrbot_plugin_moviepilot",
|
||||||
"AstrBot MoviePilot Contributors",
|
"AstrBot MoviePilot Contributors",
|
||||||
"在 AstrBot 中通过命令和 LLM 控制 MoviePilot。",
|
"在 AstrBot 中通过命令和 LLM 控制 MoviePilot。",
|
||||||
"0.12.0",
|
"0.13.0",
|
||||||
)
|
)
|
||||||
class MoviePilotPlugin(star.Star):
|
class MoviePilotPlugin(star.Star):
|
||||||
"""MoviePilot integration entrypoint."""
|
"""MoviePilot integration entrypoint."""
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,13 @@ class MediaService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _media_id(media: Mapping[str, Any]) -> str:
|
def _media_id(media: Mapping[str, Any]) -> str:
|
||||||
for key in ("mediaid", "media_id", "id", "mediaId", "tmdb_id", "tmdbid"):
|
for key in ("mediaid", "media_id", "id", "mediaId"):
|
||||||
value = media.get(key)
|
value = media.get(key)
|
||||||
if value:
|
if value:
|
||||||
return str(value)
|
return str(value)
|
||||||
|
tmdb_id = media.get("tmdb_id") or media.get("tmdbid") or media.get("tmdbId")
|
||||||
|
if tmdb_id:
|
||||||
|
return f"tmdb:{tmdb_id}"
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: astrbot_plugin_moviepilot
|
||||||
display_name: MoviePilot 控制
|
display_name: MoviePilot 控制
|
||||||
description: 在 AstrBot 中通过命令和 LLM 控制 MoviePilot。
|
description: 在 AstrBot 中通过命令和 LLM 控制 MoviePilot。
|
||||||
short_desc: 搜索影视、订阅、下载和接收 MoviePilot 通知。
|
short_desc: 搜索影视、订阅、下载和接收 MoviePilot 通知。
|
||||||
version: 0.12.0
|
version: 0.13.0
|
||||||
author: AstrBot MoviePilot Contributors
|
author: AstrBot MoviePilot Contributors
|
||||||
repo: https://github.com/jxxghp/MoviePilot
|
repo: https://github.com/jxxghp/MoviePilot
|
||||||
astrbot_version: ">=4.16,<5"
|
astrbot_version: ">=4.16,<5"
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ async def test_media_and_resource_results_are_cached(service) -> None:
|
||||||
resources = await service.search_resources("session", media[0])
|
resources = await service.search_resources("session", media[0])
|
||||||
|
|
||||||
assert media[0]["id"] == "tmdb:1"
|
assert media[0]["id"] == "tmdb:1"
|
||||||
|
assert MediaService._media_id({"tmdb_id": 276161}) == "tmdb:276161"
|
||||||
assert resources[0]["site"] == "site-a"
|
assert resources[0]["site"] == "site-a"
|
||||||
assert service._session_store.get_resource_result("session", 1) == resources[0]
|
assert service._session_store.get_resource_result("session", 1) == resources[0]
|
||||||
|
|
||||||
|
|
@ -76,4 +77,4 @@ def test_media_formatter_uses_moviepilot_metadata_fields() -> None:
|
||||||
assert "上映年月:2026-06" in text
|
assert "上映年月:2026-06" in text
|
||||||
assert "集数:12" in text
|
assert "集数:12" in text
|
||||||
assert "评分:9.5" in text
|
assert "评分:9.5" in text
|
||||||
assert media_poster_url({"poster_path": "https://image.tmdb.org/p/t.jpg"})
|
assert media_poster_url({"poster_path": "https://image.tmdb.org/p/t.jpg"})
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ def test_metadata_contains_required_plugin_fields() -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
assert metadata["name"] == "astrbot_plugin_moviepilot"
|
assert metadata["name"] == "astrbot_plugin_moviepilot"
|
||||||
assert metadata["version"] == "0.12.0"
|
assert metadata["version"] == "0.13.0"
|
||||||
assert metadata["astrbot_version"] == ">=4.16,<5"
|
assert metadata["astrbot_version"] == ">=4.16,<5"
|
||||||
assert "aiocqhttp" in metadata["support_platforms"]
|
assert "aiocqhttp" in metadata["support_platforms"]
|
||||||
assert "telegram" in metadata["support_platforms"]
|
assert "telegram" in metadata["support_platforms"]
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用