Closed sjtuross closed 5 months ago
plex 原始服务是正常的吗?不确实是不是反代补充了一些 strm 视频容器格式导致的
不经过反代,Infuse加载plex的strm库也是这样子,所以不是反代造成的,但反代可能可以解决?
额,这个,反代不一定能解决,不过可以尝试一下,之后我加个配置项开启 strm 缺失的信息模拟吧,但是也只是用默认媒体格式去模拟,应该会导致详情页里边的一些信息就会显示错误
已经找网友协助测试过了,修补了一些假数据返回也是同样的结果,这应该是没办法了,剩下的就是媒体内部编码信息了,这个是需要 plex 自己刮削的,plex 官方都放弃了 strm 的支持,建议还是用 软连接 吧
感谢尝试!
我用QX对Infuse抓包,发现下面这个请求的响应结果中,那2个STRM库的hidden字段值都为2。根据这里的说明 https://www.plexopedia.com/plex-media-server/api/server/libraries/ ,hidden字段定义如下,但并没有2,我猜测2可能代表unsupported
,所以能否尝试通过反代把hidden=2改成0?Infuse对STRM库貌似不发起后续的请求,没发现任何请求错误。
https://plex-k3s.exmaple.com:32400/library/sections?skipRefresh=1&excludeAllLeaves=1&includeCollections=1
{
"MediaContainer": {
"size": 10,
"totalSize": 10,
"offset": 0,
"allowSync": false,
"title1": "Plex Library",
"Directory": [
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/13/composite/1716288280",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "13",
"type": "movie",
"title": "STRM 电影",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "zh-CN",
"uuid": "b544aa5b-9657-4c0c-a391-05b9cbf041ec",
"updatedAt": 1716288331,
"createdAt": 1715786903,
"scannedAt": 1716288280,
"content": true,
"directory": true,
"contentChangedAt": 1214808,
"hidden": 2,
"Location": [
{
"id": 37,
"path": "/CloudNAS/merged-strm/movie"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/8/composite/1716288249",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "8",
"type": "movie",
"title": "云电影",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "zh-CN",
"uuid": "555ca993-884e-4bfc-b1c6-3ac43bfa868c",
"updatedAt": 1716288299,
"createdAt": 1691841761,
"scannedAt": 1716288249,
"content": true,
"directory": true,
"contentChangedAt": 1218382,
"hidden": 0,
"Location": [
{
"id": 31,
"path": "/CloudNAS/merged/movie"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/4/composite/1716288249",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "4",
"type": "movie",
"title": "动画电影",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "zh-CN",
"uuid": "01628d55-e0de-4ef8-ad2e-021a3e4843df",
"updatedAt": 1716288299,
"createdAt": 1658058598,
"scannedAt": 1716288249,
"content": true,
"directory": true,
"contentChangedAt": 322895,
"hidden": 0,
"Location": [
{
"id": 5,
"path": "/media/radarr/anime"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/1/composite/1716288262",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "1",
"type": "movie",
"title": "本地电影",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "zh-CN",
"uuid": "53cb7bc1-cad1-4ac9-8d39-36611dd77da2",
"updatedAt": 1716288317,
"createdAt": 1656148116,
"scannedAt": 1716288262,
"content": true,
"directory": true,
"contentChangedAt": 1145096,
"hidden": 0,
"Location": [
{
"id": 10,
"path": "/media/radarr/mUHD"
},
{
"id": 11,
"path": "/media/radarr/movie"
}
]
},
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/6/composite/1716288262",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/movie.png",
"key": "6",
"type": "movie",
"title": "演唱会",
"agent": "tv.plex.agents.movie",
"scanner": "Plex Movie",
"language": "zh-CN",
"uuid": "9f19c696-6e90-4892-9824-963288ba885c",
"updatedAt": 1716288317,
"createdAt": 1658058773,
"scannedAt": 1716288262,
"content": true,
"directory": true,
"contentChangedAt": 102647,
"hidden": 0,
"Location": [
{
"id": 9,
"path": "/media/radarr/concert"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/14/composite/1716288276",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "14",
"type": "show",
"title": "STRM 剧集",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "zh-CN",
"uuid": "e1c6737e-dc95-41de-b71f-fa47488e6f95",
"updatedAt": 1716288920,
"createdAt": 1715786967,
"scannedAt": 1716288276,
"content": true,
"directory": true,
"contentChangedAt": 1219021,
"hidden": 2,
"Location": [
{
"id": 38,
"path": "/CloudNAS/merged-strm/tvshow"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/7/composite/1716288242",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "7",
"type": "show",
"title": "云剧集",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "zh-CN",
"uuid": "bdedf453-9712-4350-ad9c-3261012310d2",
"updatedAt": 1716289034,
"createdAt": 1691596825,
"scannedAt": 1716288242,
"content": true,
"directory": true,
"contentChangedAt": 1219110,
"hidden": 0,
"Location": [
{
"id": 32,
"path": "/CloudNAS/merged/tvshow"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/3/composite/1716288249",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "3",
"type": "show",
"title": "动画剧集",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "zh-CN",
"uuid": "3e8f4039-a68e-4730-bd26-1a28f5b0e65d",
"updatedAt": 1716288297,
"createdAt": 1656764017,
"scannedAt": 1716288249,
"content": true,
"directory": true,
"contentChangedAt": 1148500,
"hidden": 0,
"Location": [
{
"id": 4,
"path": "/media/sonarr/anime"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/2/composite/1716288249",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "2",
"type": "show",
"title": "本地剧集",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "zh-CN",
"uuid": "ff4886af-2568-41e2-8c27-00f5238e602e",
"updatedAt": 1716288299,
"createdAt": 1656148169,
"scannedAt": 1716288249,
"content": true,
"directory": true,
"contentChangedAt": 1150243,
"hidden": 0,
"Location": [
{
"id": 7,
"path": "/media/tvshow/other"
},
{
"id": 8,
"path": "/media/sonarr/tvshow"
}
]
},
{
"allowSync": true,
"art": "/:/resources/show-fanart.jpg",
"composite": "/library/sections/5/composite/1716288262",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/show.png",
"key": "5",
"type": "show",
"title": "纪录片",
"agent": "tv.plex.agents.series",
"scanner": "Plex TV Series",
"language": "zh-CN",
"uuid": "b3c4dfa3-7544-4264-9868-598d736c84ce",
"updatedAt": 1716288317,
"createdAt": 1658058657,
"scannedAt": 1716288262,
"content": true,
"directory": true,
"contentChangedAt": 1144246,
"hidden": 0,
"Location": [
{
"id": 6,
"path": "/media/sonarr/documentary"
}
]
}
]
}
}
多谢提供出处,这个接口是请求的自己 plex 服务器吗?如果是直接请求的 plex 官方服务器那 nginx 就没法反代修改了
是自己服务器,只要带上X-Plex-Token就行,下面是完整的请求头
GET /library/sections?skipRefresh=1&excludeAllLeaves=1&includeCollections=1 HTTP/1.1
Host: plex-k3s.example.com:32400
Accept: application/json
X-Plex-Container-Start: 0
X-Plex-Device: iPhone
X-Plex-Platform: iOS
X-Plex-Product: Infuse-Direct
X-Plex-Client-Identifier: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
X-Plex-Container-Size: 2000
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate, br
X-Plex-Device-Name: iPhone
X-Plex-Version: 7.7.5
X-Plex-Language: en
User-Agent: Infuse-Direct/7.7.5
X-Plex-Token: XXXXXXXXXXXXXXXXXXXX
Connection: keep-alive
好的,那我尝试修改测试下
我这边测试环境不太好弄,你可以先用这些片段试下
plex.conf
# librarySectionsPlexApiHandler
location ~* /library/sections$ {
proxy_set_header Accept-Encoding "";
add_header X-Modify-Success true;
js_body_filter plex2Pan.librarySectionsPlexApiHandler;
proxy_pass $plex;
}
# PlexApiHandler ## 参考定位这行上边,不要复制这行
plex.js
function librarySectionsPlexApiHandler(r, data, flags) {
events.njsOnExit(r.uri);
const contentType = r.headersOut["Content-Type"];
//r.log(`plexApiHandler Content-Type Header: ${contentType}`);
if (contentType.includes("application/json")) {
allData += data;
if (!flags.last) return;
let body = JSON.parse(allData);
body.MediaContainer.Directory.map(dir => {
if (dir.hidden == 2) {
dir.hidden = 0;
r.warn(`${dir.title}, modify hidden 2 => 0`);
}
});
r.sendBuffer(JSON.stringify(body), flags);
} else if (contentType.includes("text/xml")) {
allData += data;
if (!flags.last) return;
let body = xml.parse(allData);
body.MediaContainer.$tags$Directory.map(dir => {
if (dir.$attr$hidden == "2") {
dir.$attr$hidden = "0";
r.warn(`${dir.title}, modify hidden 2 => 0`);
}
});
r.sendBuffer(xml.serialize(body), flags);
} else {
r.sendBuffer(data, flags);
}
}
// function plexApiHandler(r, data, flags) { // 参考定位这行上边,不要复制这行
// 最下边的函数导出加上新方法
export default {
librarySectionsPlexApiHandler,
plexApiHandler, // 参考定位这行上边,不要复制这行
};
试过了,没有用。我研究了一下,这个hidden不是之前想象的意思,Plex的库设置中有个可见性选项,如果设置成从全局搜索结果和主页排除,这个hidden就是2。
VidHub/Fileball都可以正常用plex的strm库,但只有Infuse完美支持DV,大库用strm是想不扫片头。暂时只能放弃了,浪费大佬不少时间
测试中发现代码中的一个小问题,应该是plexPathMapping
,估计是复制黏贴错了
1.没事,还好,我这边没 Infuse 的测试环境,所以测试没费多少时间 2.这个确实,两边同步复制,有时候会漏一些,多谢提醒
无法进入片子的详情页面,我录了个视频,大佬看看有没有可能解决?
https://github.com/chen3861229/embyExternalUrl/assets/940110/8911d380-5e60-47b2-aa29-51778eff17e6
日志貌似没什么错误