fix(mediaserver,architecture): 补全流式票据兼容、英文翻译与存储模块契约

This commit is contained in:
jxxghp
2026-11-26 00:08:45 +08:00
parent a8533f5c59
commit c4e812926e
6 changed files with 93 additions and 3 deletions

View File

@@ -158,7 +158,10 @@ def _resolve_stream_item(
if not _is_file_stream_ticket(itemid):
server_name, item, path = _find_stream_item(itemid, **({"server": server} if server else {}))
return server_name, item, path
storage_ticket = _resolve_storage_file_stream_ticket(itemid, user_id)
try:
storage_ticket = _resolve_storage_file_stream_ticket(itemid, user_id)
except HTTPException:
storage_ticket = None
if storage_ticket is not None:
storage_item, ticket_media_type = storage_ticket
item_type = "Audio" if ticket_media_type == "audio" else "Episode"

View File

@@ -301,7 +301,11 @@
"STRM 上游不支持 Range,无法提供可靠跳转": "The STRM source does not support Range requests, so reliable seeking is unavailable",
"该音乐格式不支持在线播放": "This music format cannot be streamed",
"仅支持本地媒体文件": "Only local media files are supported",
"仅支持媒体文件": "Only media files are supported",
"该文件格式不支持在线播放": "This file format cannot be streamed",
"该文件格式不支持在线流式播放": "This file format does not support online streaming",
"该存储暂不支持在线流式播放": "This storage does not support online streaming",
"未找到远端媒体文件": "Remote media file was not found",
"媒体服务器剧集查询失败": "The media server failed to look up the episode",
"未找到媒体服务器字幕": "Media server subtitle was not found",
"媒体服务器浏览请求失败": "Media server browse request failed",
@@ -736,6 +740,10 @@
"source": "订阅分类无效:{reason}",
"target": "Invalid subscription classification: {reason}"
},
{
"source": "订阅媒体类型无效:{type}",
"target": "Invalid subscription media type: {type}"
},
{
"source": "不支持的推荐来源: {source}",
"target": "Unsupported recommendation source: {source}"

View File

@@ -469,6 +469,28 @@ _METHOD_CONTRACTS = {
aggregation=ModuleResultAggregation.FIRST_NON_EMPTY,
required_parameters=("fileitem", "path"),
),
"supports_file_stream": ModuleMethodContract(
family="storage",
input_contract="StorageStreamSupportRequest",
result_contract="bool | None",
result_shape=ModuleResultShape.BOOLEAN,
aggregation=ModuleResultAggregation.FIRST_NON_EMPTY,
required_parameters=("storage",),
),
"get_file_stream_url": ModuleMethodContract(
family="storage",
input_contract="StorageStreamUrlRequest",
result_contract="tuple[str, dict[str, str]] | None",
aggregation=ModuleResultAggregation.FIRST_NON_EMPTY,
required_parameters=("fileitem",),
),
"open_file_stream": ModuleMethodContract(
family="storage",
input_contract="StorageOpenStreamRequest",
result_contract="tuple[BinaryIO, int] | None",
aggregation=ModuleResultAggregation.FIRST_NON_EMPTY,
required_parameters=("fileitem",),
),
"upload_file": ModuleMethodContract(
family="storage",
input_contract="StorageUploadRequest",

View File

@@ -139,7 +139,7 @@
{"source": "app.agent.llm.discovery", "target": "openai", "kind": "network_sdk", "fingerprint": "fff154461ff3fdfdf1daea0530dcb68589d6ad7a67f3966e3b86338b483e6dfd"},
{"source": "app.agent.tools.impl.search_web", "target": "ddgs", "kind": "network_sdk", "fingerprint": "377e73bb3be804b825d60ad6e792344ca633de107f8c4dbb45d50a34a4dfa04b"},
{"source": "app.modules.discord.discord", "target": "discord", "kind": "network_sdk", "fingerprint": "2761ef9a9e5a805bfb20ea832c5d34edea12db21ca3eb27c3db7ce512a5ee7f5"},
{"source": "app.modules.filemanager.storages.smb", "target": "smbclient", "kind": "network_sdk", "fingerprint": "37619f050b03598fa559c6ae2df94bda6adf7cffd1cc42d9db9059f1fb41af47"},
{"source": "app.modules.filemanager.storages.smb", "target": "smbclient", "kind": "network_sdk", "fingerprint": "bfc6993d05d5d33dfcb8044fda6c89a3cc3c599fecb0fe327cefd9e1f9145092"},
{"source": "app.modules.filemanager.storages.u115", "target": "oss2", "kind": "network_sdk", "fingerprint": "f7b89c8ae6dad2603f0a9e0caaa159769aef5b3581d7e728f62445b979366eae"},
{"source": "app.modules.plex.plex", "target": "plexapi", "kind": "network_sdk", "fingerprint": "27343fdd0761e0be7090b4dbf3b2f39cab07116f5c9435d2e2454e5f4af7a976"},
{"source": "app.modules.qbittorrent.qbittorrent", "target": "qbittorrentapi", "kind": "network_sdk", "fingerprint": "b2f5a27f0c54cf95ed42fe99848fd6c9c0641caca8bc4ff8006a411cb427066d"},

View File

@@ -6250,6 +6250,25 @@
"timeout_policy": "caller_budget",
"version": 1
},
"get_file_stream_url": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",
"execution": "sync_or_async",
"family": "storage",
"input_contract": "StorageStreamUrlRequest",
"optional_parameters": [],
"plugin_short_circuit": true,
"public_to_plugins": true,
"required_parameters": [
"fileitem"
],
"result_contract": "tuple[str, dict[str, str]] | None",
"result_shape": "any",
"supports_async": true,
"supports_sync": true,
"timeout_policy": "caller_budget",
"version": 1
},
"get_folder": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",
@@ -7683,6 +7702,25 @@
"timeout_policy": "caller_budget",
"version": 1
},
"open_file_stream": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",
"execution": "sync_or_async",
"family": "storage",
"input_contract": "StorageOpenStreamRequest",
"optional_parameters": [],
"plugin_short_circuit": true,
"public_to_plugins": true,
"required_parameters": [
"fileitem"
],
"result_contract": "tuple[BinaryIO, int] | None",
"result_shape": "any",
"supports_async": true,
"supports_sync": true,
"timeout_policy": "caller_budget",
"version": 1
},
"parse_torrent_download_confirmation": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",
@@ -8245,6 +8283,25 @@
"timeout_policy": "caller_budget",
"version": 1
},
"supports_file_stream": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",
"execution": "sync_or_async",
"family": "storage",
"input_contract": "StorageStreamSupportRequest",
"optional_parameters": [],
"plugin_short_circuit": true,
"public_to_plugins": true,
"required_parameters": [
"storage"
],
"result_contract": "bool | None",
"result_shape": "boolean",
"supports_async": true,
"supports_sync": true,
"timeout_policy": "caller_budget",
"version": 1
},
"test_site": {
"aggregation": "first_non_empty",
"error_policy": "isolate_provider",

View File

@@ -127,7 +127,7 @@ FROZEN_EGRESS_FINGERPRINT_BY_EDGE = {
("app.modules.discord.discord", "discord"): "2761ef9a9e5a805bfb20ea832c5d34edea12db21ca3eb27c3db7ce512a5ee7f5",
("app.modules.emby.emby", "requests"): "6c4c17fe170226ea1272f5859bc119c2775442cabe8ce2a9edcabaf9c37bec31",
("app.adapters.network.feishu", "websocket"): "95aca65eed288e0c7654ab49aad6c535d9313d5e38c44b1cb1768dcdfc772453",
("app.modules.filemanager.storages.smb", "smbclient"): "37619f050b03598fa559c6ae2df94bda6adf7cffd1cc42d9db9059f1fb41af47",
("app.modules.filemanager.storages.smb", "smbclient"): "bfc6993d05d5d33dfcb8044fda6c89a3cc3c599fecb0fe327cefd9e1f9145092",
("app.modules.filemanager.storages.smb", "smbprotocol"): "f02686afd99c59820dffa7b4c2627a0be1ad62980c98a9cd33b7564697842b22",
("app.modules.filemanager.storages.u115", "oss2"): "f7b89c8ae6dad2603f0a9e0caaa159769aef5b3581d7e728f62445b979366eae",
("app.modules.jellyfin.jellyfin", "requests"): "5c46d09ca9a4bcc0bae21ca5d554ef09baa3f901c562b27c5f5ee1439c7746b5",