Add TMDb-backed Emby people metadata and image caching

This commit is contained in:
truewhile
2026-09-12 16:31:57 +08:00
parent 41fe75e136
commit df654ea47b
17 changed files with 759 additions and 78 deletions
+4 -4
View File
@@ -29,7 +29,7 @@ var embyPlaceholderPNG = []byte{
// /api/img 会变成 401,所以这里复用 ImageProxy 但不再走 /api 路由。
func embyItemImageHandler(svc *service.Container) gin.HandlerFunc {
return func(c *gin.Context) {
embyServeImage(c, svc, c.Param("id"), c.Param("type"), false)
embyServeImage(c, svc, c.Param("id"), c.Param("type"), c.Query("tag"), false)
}
}
@@ -37,11 +37,11 @@ func embyItemImageHandler(svc *service.Container) gin.HandlerFunc {
// Name 可能是伪装后的远程人物 ID,也可能是电影详情 People 中的显示名称。
func embyPersonImageHandler(svc *service.Container) gin.HandlerFunc {
return func(c *gin.Context) {
embyServeImage(c, svc, c.Param("name"), c.Param("type"), true)
embyServeImage(c, svc, c.Param("name"), c.Param("type"), c.Query("tag"), true)
}
}
func embyServeImage(c *gin.Context, svc *service.Container, id, imageType string, person bool) {
func embyServeImage(c *gin.Context, svc *service.Container, id, imageType, tag string, person bool) {
clearEmbyImageNoStoreHeaders(c)
ctx, cancel := context.WithTimeout(c.Request.Context(), 8*time.Second)
defer cancel()
@@ -53,7 +53,7 @@ func embyServeImage(c *gin.Context, svc *service.Container, id, imageType string
var raw string
var err error
if person {
raw, err = svc.Emby.PersonImageURL(ctx, id, imageType)
raw, err = svc.Emby.PersonImageURL(ctx, id, imageType, tag)
} else {
raw, err = svc.Emby.ImageURL(ctx, id, imageType)
}