Publish current app and server

This commit is contained in:
ponzischeme89
2026-08-02 22:10:19 +12:00
parent a265636139
commit 1ed180c739
203 changed files with 23933 additions and 2788 deletions
+11 -7
View File
@@ -37,7 +37,8 @@ const (
// syncFields is everything the gateway serves or filters on. Images are requested as
// tags only — the artwork itself is proxied on demand.
syncFields = "Genres,Studios,Overview,Taglines,ProductionYear,CommunityRating,OfficialRating," +
"RunTimeTicks,SeriesName,PrimaryImageAspectRatio,DateCreated,MediaStreams"
"RunTimeTicks,SeriesName,PrimaryImageAspectRatio,DateCreated,PremiereDate,People," +
"CollectionName,MediaStreams,RecursiveItemCount"
syncImageTypes = "Backdrop,Primary,Logo,Thumb"
syncItemTypes = "Movie,Series,Episode"
@@ -58,7 +59,7 @@ type Syncer struct {
mu sync.Mutex
running bool
afterSync func()
afterSync func(Result)
}
func NewSyncer(embyClient *emby.Client, st *store.Store, serviceCred emby.Credentials, log *slog.Logger) *Syncer {
@@ -66,7 +67,7 @@ func NewSyncer(embyClient *emby.Client, st *store.Store, serviceCred emby.Creden
}
// SetAfterSync installs the inexpensive invalidation callback used by derived data.
func (s *Syncer) SetAfterSync(callback func()) {
func (s *Syncer) SetAfterSync(callback func(Result)) {
s.mu.Lock()
defer s.mu.Unlock()
s.afterSync = callback
@@ -77,6 +78,7 @@ type Result struct {
Kind string `json:"kind"`
Seen int `json:"seen"`
Upserted int `json:"upserted"`
Changed int `json:"changed"`
Removed int `json:"removed"`
Duration time.Duration `json:"-"`
DurationMs int64 `json:"durationMs"`
@@ -156,13 +158,13 @@ func (s *Syncer) Sync(ctx context.Context, kind, trigger string) (Result, error)
}
s.log.Info("library sync finished",
"kind", kind, "trigger", trigger, "seen", result.Seen,
"upserted", result.Upserted, "removed", result.Removed,
"upserted", result.Upserted, "changed", result.Changed, "removed", result.Removed,
"duration", result.Duration.Round(time.Millisecond))
s.mu.Lock()
afterSync := s.afterSync
s.mu.Unlock()
if afterSync != nil {
afterSync()
afterSync(result)
}
return result, nil
}
@@ -213,17 +215,19 @@ func (s *Syncer) run(
items = append(items, item)
}
}
written, err := s.store.UpsertLibraryItems(ctx, items, syncedAt)
changed, err := s.store.UpsertLibraryItems(ctx, items, syncedAt)
if err != nil {
return result, err
}
result.Seen += len(page.Items)
result.Upserted += int(written)
result.Upserted += len(items)
result.Changed += int(changed)
s.log.Info("library sync progress",
"kind", kind,
"seen", result.Seen,
"upserted", result.Upserted,
"changed", result.Changed,
)
if len(page.Items) < pageSize {