bpking1 / embyExternalUrl

some emby/jellyfin scripts
MIT License
785 stars 137 forks source link

strm重定向不生效 #309

Closed bigmouse0001 closed 3 months ago

bigmouse0001 commented 3 months ago

只修改了以下内容,但是不起作用

const mediaPathMapping = [ [0, 2, "http://127.0.0.1:5244", "http://www.12345.xyz:8096"], // [0, 0, "/aliyun-01", "/aliyun-02"], // [0, 2, "http:", "https:"], // [0, 2, ":5244", "/alist"], // [0, 0, "D:", "F:"], // [0, 0, /blue/g, "red"], // 此处正则不要加引号 // [1, 1, ${alistPublicAddr}/d], // [2, 2, "?xxx"], ];

日志显示没有进行redirect,请问还需要修改其他配置吗?教一下,谢谢~:

2024/07/25 06:10:49 [notice] 27#27: 28 a client request body is buffered to a temporary file /var/lib/nginx/tmp/client_body/0000000007, client: 192.168.1.9, server: default, request: "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=true&AutoOpenLiveStream=true&StartTimeTicks=0&MaxStreamingBitrate=2147483647&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c HTTP/1.1", host: "192.168.1.5:8091" 2024/07/25 06:10:49 [warn] 27#27: 28 js: playbackinfo proxy uri: /proxy/emby/Items/22/PlaybackInfo 2024/07/25 06:10:49 [warn] 27#27: 28 js: playbackinfo proxy query string: UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=true&AutoOpenLiveStream=true&StartTimeTicks=0&MaxStreamingBitrate=2147483647&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c 2024/07/25 06:10:49 [info] 27#27: 28 js: main request headersOut: {} 2024/07/25 06:10:49 [info] 27#27: 28 js: subrequest headersOut: {"Content-Type":"application/json; charset=utf-8","Content-Length":"1839","Access-Control-Allow-Headers":"Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Token, X-Emby-Client, X-Emby-Client-Version, X-Emby-Device-Id, X-Emby-Device-Name, X-Emby-Authorization","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Origin":"","Cross-Origin-Resource-Policy":"cross-origin","Access-Control-Allow-Private-Network":"true","Private-Network-Access-Name":"23968d02035b","Private-Network-Access-Id":"7837ce8967994c9dae14fc53a6691f01"} 2024/07/25 06:10:49 [warn] 27#27: 28 js: origin playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=1e9c9de73f7b447ebc65d035df0812ed&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=1e9c9de73f7b447ebc65d035df0812ed&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22"}],"PlaySessionId":"1e9c9de73f7b447ebc65d035df0812ed"} 2024/07/25 06:10:49 [warn] 27#27: 28 js: modify direct play supports all true 2024/07/25 06:10:49 [warn] 27#27: 28 js: modify direct play info 2024/07/25 06:10:49 [warn] 27#27: 28 js: 241ms, transfer playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":false,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/stream.strm?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=2147483647&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&api_key=275e496ee3a446df8567972ee17b0597&PlaySessionId=1e9c9de73f7b447ebc65d035df0812ed&Static=true","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=1e9c9de73f7b447ebc65d035df0812ed&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22","XRouteMode":"redirect","XOriginDirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=1e9c9de73f7b447ebc65d035df0812ed&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitra 192.168.1.9 - - [25/Jul/2024:06:10:49 +0000] "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=true&AutoOpenLiveStream=true&StartTimeTicks=0&MaxStreamingBitrate=2147483647&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c HTTP/1.1" 200 2208 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:10:49 [warn] 27#27: 28 js: === transferPlaybackInfo: /emby/Items/22/PlaybackInfo, the NJS VM is destroyed === 192.168.1.9 - - [25/Jul/2024:06:10:49 +0000] "GET /emby/Users/584dc2fbbaa74534ac913996d948e0f0/Items/22 HTTP/1.1" 200 3939 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:10:49 [notice] 27#27: 28 a client request body is buffered to a temporary file /var/lib/nginx/tmp/client_body/0000000008, client: 192.168.1.9, server: default, request: "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 HTTP/1.1", host: "192.168.1.5:8091" 2024/07/25 06:10:49 [warn] 27#27: 28 js: playbackinfo proxy uri: /proxy/emby/Items/22/PlaybackInfo 2024/07/25 06:10:49 [warn] 27#27: 28 js: playbackinfo proxy query string: UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 2024/07/25 06:10:49 [info] 27#27: 28 js: main request headersOut: {} 2024/07/25 06:10:49 [info] 27#27: 28 js: subrequest headersOut: {"Content-Type":"application/json; charset=utf-8","Content-Length":"1839","Access-Control-Allow-Headers":"Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Token, X-Emby-Client, X-Emby-Client-Version, X-Emby-Device-Id, X-Emby-Device-Name, X-Emby-Authorization","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Origin":"","Cross-Origin-Resource-Policy":"cross-origin","Access-Control-Allow-Private-Network":"true","Private-Network-Access-Name":"23968d02035b","Private-Network-Access-Id":"7837ce8967994c9dae14fc53a6691f01"} 2024/07/25 06:10:49 [warn] 27#27: 28 js: origin playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=7232f3114c464c1dac6bee22d2e02dbc&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=7232f3114c464c1dac6bee22d2e02dbc&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22"}],"PlaySessionId":"7232f3114c464c1dac6bee22d2e02dbc"} 2024/07/25 06:10:49 [warn] 27#27: 28 js: modify direct play supports all true 2024/07/25 06:10:49 [warn] 27#27: 28 js: modify direct play info 2024/07/25 06:10:49 [warn] 27#27: 28 js: 46ms, transfer playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":false,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/stream.strm?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&MaxStreamingBitrate=2147483647&api_key=275e496ee3a446df8567972ee17b0597&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=7232f3114c464c1dac6bee22d2e02dbc&Static=true","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=7232f3114c464c1dac6bee22d2e02dbc&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22","XRouteMode":"redirect","XOriginDirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=7232f3114c464c1dac6bee22d2e02dbc&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitr 192.168.1.9 - - [25/Jul/2024:06:10:49 +0000] "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 HTTP/1.1" 200 2210 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:10:49 [warn] 27#27: 28 js: === transferPlaybackInfo: /emby/Items/22/PlaybackInfo, the NJS VM is destroyed === 192.168.1.9 - - [25/Jul/2024:06:10:49 +0000] "GET /emby/Users/584dc2fbbaa74534ac913996d948e0f0/Items?Limit=20&IncludeItemTypes=Playlist%2CBoxSet&ListItemIds=22&SortBy=SortName&Fields=BasicSyncInfo%2CCanDelete%2CContainer%2CPrimaryImageAspectRatio%2CUserData&Recursive=true HTTP/1.1" 200 529 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:11:49 [info] 27#27: 28 client 192.168.1.9 closed keepalive connection 192.168.1.9 - - [25/Jul/2024:06:12:51 +0000] "GET /emby/Users/584dc2fbbaa74534ac913996d948e0f0/Items/22 HTTP/1.1" 200 3939 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:12:51 [notice] 27#27: 33 a client request body is buffered to a temporary file /var/lib/nginx/tmp/client_body/0000000009, client: 192.168.1.9, server: default, request: "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 HTTP/1.1", host: "192.168.1.5:8091" 2024/07/25 06:12:51 [warn] 27#27: 33 js: playbackinfo proxy uri: /proxy/emby/Items/22/PlaybackInfo 2024/07/25 06:12:51 [warn] 27#27: 33 js: playbackinfo proxy query string: UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 2024/07/25 06:12:51 [info] 27#27: 33 js: main request headersOut: {} 2024/07/25 06:12:51 [info] 27#27: 33 js: subrequest headersOut: {"Content-Type":"application/json; charset=utf-8","Content-Length":"1839","Access-Control-Allow-Headers":"Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Token, X-Emby-Client, X-Emby-Client-Version, X-Emby-Device-Id, X-Emby-Device-Name, X-Emby-Authorization","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Origin":"","Cross-Origin-Resource-Policy":"cross-origin","Access-Control-Allow-Private-Network":"true","Private-Network-Access-Name":"23968d02035b","Private-Network-Access-Id":"7837ce8967994c9dae14fc53a6691f01"} 2024/07/25 06:12:51 [warn] 27#27: 33 js: origin playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=565f812a1552480ea296df71bc07cdbe&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=565f812a1552480ea296df71bc07cdbe&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22"}],"PlaySessionId":"565f812a1552480ea296df71bc07cdbe"} 2024/07/25 06:12:51 [warn] 27#27: 33 js: modify direct play supports all true 2024/07/25 06:12:51 [warn] 27#27: 33 js: modify direct play info 2024/07/25 06:12:51 [warn] 27#27: 33 js: 20ms, transfer playbackinfo: {"MediaSources":[{"Protocol":"Http","Id":"8cf3d5fc70c4e519411d1b583fee005c","Path":"http://127.0.0.1:5244/d%2F115%2F%E5%8A%A8%E6%BC%AB%E7%94%B5%E5%BD%B1%2F%E5%93%88%E5%88%A9%20%C2%B7%20%E6%B3%A2%E7%89%B9%EF%BC%88%E5%85%A88%E5%AD%A3%E5%9B%BD%E8%AF%AD1080p%E6%94%B6%E8%97%8F%E7%89%88%EF%BC%89%2FHarry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai.mkv","Type":"Default","Container":"strm","Size":0,"Name":"Harry.Potter.and.the.Prisoner.of.Azkaban.2004.BluRay.1080p.3Audio.TrueHD.5.1.x265.10bit-BeiTai","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":false,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"DirectStreamUrl":"/videos/22/stream.strm?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&MaxStreamingBitrate=2147483647&api_key=275e496ee3a446df8567972ee17b0597&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=565f812a1552480ea296df71bc07cdbe&Static=true","AddApiKeyToDirectStreamUrl":false,"TranscodingUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=565f812a1552480ea296df71bc07cdbe&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitrate=2147483647&TranscodingMaxAudioChannels=6&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=True&TranscodeReasons=ContainerNotSupported","TranscodingSubProtocol":"hls","TranscodingContainer":"ts","ReadAtNativeFramerate":false,"ItemId":"22","XRouteMode":"redirect","XOriginDirectStreamUrl":"/videos/22/master.m3u8?DeviceId=a501d827-5fed-4b9f-b14b-f2667695a494&MediaSourceId=8cf3d5fc70c4e519411d1b583fee005c&PlaySessionId=565f812a1552480ea296df71bc07cdbe&api_key=08c1d846a9af41f28f39882417cd799a&VideoCodec=hevc,h264,mpeg4&VideoBitr 192.168.1.9 - - [25/Jul/2024:06:12:51 +0000] "POST /emby/Items/22/PlaybackInfo?UserId=584dc2fbbaa74534ac913996d948e0f0&IsPlayback=false&AutoOpenLiveStream=false&StartTimeTicks=0&MaxStreamingBitrate=2147483647 HTTP/1.1" 200 2210 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:12:51 [warn] 27#27: 33 js: === transferPlaybackInfo: /emby/Items/22/PlaybackInfo, the NJS VM is destroyed === 192.168.1.9 - - [25/Jul/2024:06:12:51 +0000] "GET /emby/Users/584dc2fbbaa74534ac913996d948e0f0/Items?Limit=20&IncludeItemTypes=Playlist%2CBoxSet&ListItemIds=22&SortBy=SortName&Fields=BasicSyncInfo%2CCanDelete%2CContainer%2CPrimaryImageAspectRatio%2CUserData&Recursive=true HTTP/1.1" 200 529 "-" "Yamby/1.3.2.19(Android" "-" 2024/07/25 06:13:01 [info] 27#27: *33 client 192.168.1.9 closed keepalive connection (104: Connection reset by peer)

chen3861229 commented 3 months ago

1.日志中暂无有效信息,可以搜索下关键字,mapped emby file path

[0, 2, "http://127.0.0.1:5244", "http://www.12345.xyz:8096"],

2.后边这个地址看起来像是 emby 的地址?这个需要是能获取直链的服务地址,如果是 alist 可以先关闭签名测试下

3.还有种可能的话是 web 客户端不支持的媒体格式了,换对应平台的客户端试下

bigmouse0001 commented 3 months ago
  1. 问题就在于,设置路径替换规则后,全部日志里面都没有mapfilepath行为,表明路径替换没有生效

2.alist签名验证已经关闭

  1. 用的是emby小秘版客户端,媒体格式不存在问题

问题关键在于路径映射没有生效。。是因为我配置错了吗

chen3861229 commented 3 months ago

有进入 redirect2Pan, UA: 这里吗?虽然 [0, 2, "http://127.0.0.1:5244", "http://www.12345.xyz:8096"], 填得有些冗余,但是没配置错, 关键在于没有后续请求播放的日志了,也就是 redirect2Pan 中的一些后续操作

bigmouse0001 commented 3 months ago

客户端点击播放后,日志没有出现 redirect2Pan, UA,不知道是啥原因。。相关的全部配置如下。用软连接模式进行路径替换能正常进行重定向,用strm就不行,是不是我哪里配置没填对?:

const embyHost = "http://172.17.0.4:8096";

// emby/jellyfin api key, 在 emby/jellyfin 后台设置
const embyApiKey = "275e496ee3a446df8567972ee17b0597";

// 挂载工具 rclone/CD2 多出来的挂载目录, 例如将 od,gd 挂载到 /mnt 目录下: /mnt/onedrive /mnt/gd ,那么这里就填写 /mnt
// 通常配置一个远程挂载根路径就够了,默认非此路径开头文件将转给原始 emby 处理,不用重复填写至 disableRedirectRule
// 如果没有挂载,全部使用 strm 文件,此项填[""],必须要是数组
const mediaMountPath = [""];

// 访问宿主机上 5244 端口的 alist 地址, 要注意 iptables 给容器放行端口
const alistAddr = "http://172.17.0.1:5244";

// alist token, 在 alist 后台查看
const alistToken = "alsit-123456";

// alist 是否启用了 sign
const alistSignEnable = false;

// alist 中设置的直链过期时间,以小时为单位
const alistSignExpireTime = 12;

// 选填项,用不到保持默认即可

// alist 公网地址,用于需要 alist server 代理流量的情况,按需填写
const alistPublicAddr = "http://youralist.com:5244";
// 字符串头,用于特殊匹配判断
const strHead = {
  lanIp: ["172.", "10.", "192.", "[fd00:"], // 局域网ip头
  xEmbyClients: {
    seekBug: ["Emby for iOS", "Infuse"],
    maybeProxy: ["Emby Web", "Emby for iOS", "Infuse"],
  },
  "115": "115.com",
  ali: "aliyundrive.net",
};

// 路由缓存配置
const routeCacheConfig = {
  // 总开关,是否开启路由缓存,此为一级缓存,添加阶段为 redirect 和 proxy 之前
  // 短时间内同客户端访问相同资源不会再做判断和请求 alist,有限的防抖措施,出现问题可以关闭此选项
  enable: true,
  // 二级缓存开关,仅针对直链,添加阶段为进入单集详情页,clientSelfAlistRule 中的和首页直接播放的不生效
  enableL2: false,
  // 缓存键表达式,默认值好处是命中范围大,但会导致 routeRule 中针对设备的规则失效,多个变量可自行组合修改,冒号分隔
  // 注意 jellyfin 是小写开头 mediaSourceId
  keyExpression: "r.uri:r.args.MediaSourceId", // "r.uri:r.args.MediaSourceId:r.args.X-Emby-Device-Id"
};

// 指定需要获取符号链接真实路径的规则,优先级在 mediaMountPath 和 routeRule 之间
// 注意前提条件是此程序或容器必须挂载或具有对应目录的读取权限,否则将跳过处理,回源中转
// 此参数仅在软链接后的文件名和原始文件名不一致或路径差异较大时使用,其余情况建议用 mediaPathMapping
// 参数1: 0: startsWith(str), 1: endsWith(str), 2: includes(str), 3: match(/ain/g)
// 参数2: 匹配目标,对象为媒体服务入库的文件路径(Item.Path)
const symlinkRule = [
  // [0, "/mnt/sda1"],
];

// 路由规则,注意有先后顺序,"proxy"规则优先级最高,其余依次,千万注意规则不要重叠,不然排错十分困难,字幕和图片走了缓存,不在此规则内
// 参数1: 指定处理模式,单规则的默认值为"proxy",但是注意整体规则都不匹配默认值为"redirect",然后下面参数序号-1
// "proxy": 原始媒体服务器处理(中转流量), "redirect": 直链302, "transcode": 转码, "block": 只是屏蔽播放
// "transcode",稍微有些歧义,大部分情况等同于"proxy",这里只是不做转码参数修改,具体是否转码由 emby 客户端自己判断上报或客户端手动切换码率控制
// 参数2: 分组名,组内为与关系(全部匹配),多个组和没有分组的规则是或关系(任一匹配),然后下面参数序号-1
// 参数3: 匹配类型或来源(字符串参数类型) "filePath": 文件路径(Item.Path), "alistRes": alist返回的链接
// 参数4: 0: startsWith(str), 1: endsWith(str), 2: includes(str), 3: match(/ain/g)
// 参数5: 匹配目标,为数组的多个参数时,数组内为或关系(任一匹配)
const routeRule = [
  // ["filePath", 0, "/mnt/sda1"],
  // ["filePath", 1, ".mp3"],
  // ["filePath", 2, "Google"],
  // ["alistRes", 2, "/NAS/"], // 例如使用 alias 聚合了 nas 本地文件,可能会存在卡顿或花屏
  // ["filePath", 3, /private/ig],
  // docker 注意必须为 host 模式,不然此变量全部为内网ip,判断无效,nginx 内置变量不带$,客户端地址($remote_addr)
  // ["r.variables.remote_addr", 0, strHead.lanIp],
  // ["r.headersIn.User-Agent", 2, "IE"], // 请求头参数,客户端UA
  // ["r.args.X-Emby-Device-Id", 0, "d4f30461-ec5c-488d-b04a-783e6f419eb1"], // 链接入参,设备id
  // ["r.args.X-Emby-Device-Name", 0, "Microsoft Edge Windows"], // 链接入参,设备名称
  // ["r.args.UserId", 0, "ac0d220d548f43bbb73cf9b44b2ddf0e"], // 链接入参,用户id
  // 以下规则代表禁用 strHead.xEmbyClients.maybeProxy 中的[本地挂载文件或 alist 返回的链接]的 115 直链功能
  // ["115-alist", "r.args.X-Emby-Client", 0, strHead.xEmbyClients.maybeProxy], // 链接入参,客户端类型
  // ["115-alist", "alistRes", 0, strHead["115"]],
  // ["115-local", "r.args.X-Emby-Client", 0, strHead.xEmbyClients.maybeProxy],
  // ["115-local", "filePath", 0, "/mnt/115"],
  // 注意非"proxy"无法使用"alistRes"条件,因为没有获取 alist 直链的过程
  // ["proxy", "filePath", 0, "/mnt/sda1"],
  // ["redirect", "filePath", 0, "/mnt/sda2"],
  // ["transcode", "filePath", 0, "/mnt/sda3"],
  // ["transcode", "115-local", "r.args.X-Emby-Client", 0, strHead.xEmbyClients.maybeProxy],
  // ["transcode", "115-local", "filePath", 0, "/mnt/115"],
  // ["block", "filePath", 0, "/mnt/sda4"],
];

// 路径映射,会在 mediaMountPath 之后从上到下依次全部替换一遍,不要有重叠,注意 /mnt 会先被移除掉了
// 参数1: 0: 默认做字符串替换replace一次, 1: 前插, 2: 尾插, 3: replaceAll替换全部
// 参数2: 0: 默认只处理/开头的路径且不为 strm, 1: 只处理 strm 内部为/开头的相对路径, 2: 只处理 strm 内部为远程链接的
// 参数3: 来源, 参数4: 目标
const mediaPathMapping = [
    [0, 2, "http://127.0.0.1:5244", "http://www.12345.xyz:8096"],
  // [0, 0, "/aliyun-01", "/aliyun-02"],
  // [0, 2, "http:", "https:"],
  // [0, 2, ":5244", "/alist"],
  // [0, 0, "D:", "F:"],
  // [0, 0, /blue/g, "red"], // 此处正则不要加引号
  // [1, 1, `${alistPublicAddr}/d`],
  // [2, 2, "?xxx"],
];

// 指定是否转发由 njs 获取 strm/远程链接 重定向后直链地址的规则,例如 strm/远程链接 内部为局域网 ip 或链接需要验证
// 参数1: 分组名,组内为与关系(全部匹配),多个组和没有分组的规则是或关系(任一匹配),然后下面参数序号-1
// 参数2: 匹配类型或来源(字符串参数类型),默认为 "filePath": mediaPathMapping 映射后的 strm/远程链接 内部链接
// ,有分组时不可省略填写,可为表达式
// 参数3: 0: startsWith(str), 1: endsWith(str), 2: includes(str), 3: match(/ain/g)
// 参数4: 匹配目标,为数组的多个参数时,数组内为或关系(任一匹配)
const redirectStrmLastLinkRule = [
  [0, strHead.lanIp.map(s => "http://" + s)],
  // [0, alistAddr],
  // [0, "http:"],
  // 参数5: 请求验证类型,当前 alistAddr 不需要此参数
  // 参数6: 当前 alistAddr 不需要此参数,alistSignExpireTime
  // [3, "http://otheralist1.com", "sign", `${alistToken}:${alistSignExpireTime}`],
  // useGroup01 同时满足才命中
  // ["useGroup01", "filePath", 0, strHead.lanIp.map(s => "http://" + s)], // 目标地址为内网
  // ["useGroup01", "r.args.X-Emby-Client", 0, strHead.xEmbyClients.seekBug], // 链接入参,客户端类型
  // docker 注意必须为 host 模式,不然此变量全部为内网ip,判断无效,nginx 内置变量不带$,客户端地址($remote_addr)
  // ["useGroup01", "r.variables.remote_addr", 0, strHead.lanIp], // 远程客户端为内网
];

// 指定客户端自己请求并获取 alist 直链的规则,代码优先级在 redirectStrmLastLinkRule 之后
// 特殊情况使用,则此处必须使用域名且公网畅通,用不着请保持默认
// 参数1: 0: startsWith(str), 1: endsWith(str), 2: includes(str), 3: match(/ain/g)
// 参数2: 匹配目标,对象为 Alist 接口返回的链接 raw_url
// 参数3: 指定转发给客户端的 alist 的 host 前缀,兼容 sign 参数
bigmouse0001 commented 3 months ago

解决了。。需要增加一条route配置: const routeRule = [ // ["redirect", "filepath", "ip"], ];

匹配strm路径中的域名A,匹配成功则进行重定向。只有这样才能把strm内的域名A正常重定向到域名B

chen3861229 commented 3 months ago

啊,好吧,routeRule 的 redirect 是一个默认规则来着,感觉和这个关系不大,不过脚本内部现在确实优先级问题比较严重,能正常使用就好