Repository navigation
feat: enrich Plex metadata with MediaInfo - #8
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
Plex 的 STRM 条目通常缺少容器、编解码器、分辨率和 Stream 技术字段。本变更将已有的 MediaInfo fallback 基础接入单项 metadata 响应:缓存命中时直接补充缺失字段,冷缓存最多等待 5 秒,超时或任何不确定情况均原样返回 Plex 响应,探测继续在后台完成。
投影只处理认证的
GET /library/metadata/{ratingKey},严格要求唯一的 ratingKey、Media 和 Part。它只补充白名单技术字段,不覆盖 Plex 已有值,不创建未知 Stream 身份,也不处理 batch、children、HEAD、Range、Part、decision、universal start 或 timeline 请求。SQLite 配置提升为 Gateway 级
DATABASE_PATH,默认文件为plex-gateway.db。连接、WAL 和按模块迁移由internal/database统一管理,MediaInfo 只拥有自己的表。该未发布能力不保留旧MEDIAINFO_DB_PATH或mediainfo.db兼容入口。多客户端仍共享成功的 singleflight 和持久记录。如果共享探测因某个 User-Agent 失败,使用不同 User-Agent 的 waiter 会在自身截止时间内接力重试,避免一个客户端的 CDN 兼容失败抑制其他客户端。
安全与性能边界
验证
go test -count=1 ./...go test -race -count=1 ./...go vet ./...actionlintdocker build -t plex-gateway:f2-local .gateway.New、ReverseProxy、SQLite 与 MediaInfo Service 组合测试普通运行 50 次、Race 运行 20 次组合测试覆盖冷等待超时原样返回、worker 后台持久化、第二次 gzip 热增强、validator 清理,以及 Part、decision、universal start、timeline 零 MediaInfo Provider 调用。
真实 NAS、MediaVault、CDN 与 HDR/Dolby Vision 客户端消费验收属于后续部署叶,不在本 PR 中声明完成。