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
+24
View File
@@ -64,6 +64,11 @@ type EmbyService struct {
peopleMu sync.RWMutex
peopleCache map[string]embyPeopleCacheEntry
tmdb *TMDbProvider
adult *AdultProvider
personImageMu sync.RWMutex
personImages map[string]string
}
// NewEmbyService is the constructor.
@@ -79,6 +84,23 @@ func (e *EmbyService) SetEmbyRemote(remote *EmbyRemoteService) *EmbyService {
return e
}
// SetTMDbProvider wires the TMDb client used for detail-time cast/crew lookup.
func (e *EmbyService) SetTMDbProvider(tmdb *TMDbProvider) *EmbyService {
if e != nil {
e.tmdb = tmdb
}
return e
}
// SetAdultProvider wires the on-demand adult-metadata provider used when a
// detail request needs cast/crew not stored in the database.
func (e *EmbyService) SetAdultProvider(adult *AdultProvider) *EmbyService {
if e != nil {
e.adult = adult
}
return e
}
func (e *EmbyService) SetRuntimeCache(cache *RuntimeCacheService) *EmbyService {
if e != nil {
e.cache = cache
@@ -118,6 +140,8 @@ const (
embyVirtualSeriesPrefix = "msgo-series-"
embyVirtualSeasonPrefix = "msgo-season-"
embyVirtualCacheTTL = 10 * time.Minute
embyPeopleCacheTTL = 6 * time.Hour
embyPeopleEmptyCacheTTL = 15 * time.Minute
embyVisibilityCacheTTL = 30 * time.Second
embySeriesGroupingLimit = maxMediaSearchLimit
// Virtual artwork used to be wiped entirely once the in-memory map crossed