mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 11:36:36 +08:00
Add TMDb-backed Emby people metadata and image caching
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user