Documentation
¶
Overview ¶
Package watchsync ingests watch history from media servers and stores it locally for watch-aware library management.
Index ¶
- type Service
- func (s *Service) Stats(ctx context.Context) (*WatchStats, error)
- func (s *Service) Sync(ctx context.Context) error
- func (s *Service) WatchStatusBatch(ctx context.Context) (map[string]*WatchStatus, error)
- func (s *Service) WatchStatusForMovie(ctx context.Context, movieID string) (*WatchStatus, error)
- type WatchStats
- type WatchStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages watch history sync from media servers.
func NewService ¶
func NewService(q dbgen.Querier, msSvc *mediaserver.Service, movieSvc *movie.Service, reg *registry.Registry, logger *slog.Logger) *Service
NewService creates a new watch sync service.
func (*Service) Stats ¶
func (s *Service) Stats(ctx context.Context) (*WatchStats, error)
Stats returns aggregate watch statistics.
func (*Service) Sync ¶
Sync polls all configured media servers for new watch events and stores them.
func (*Service) WatchStatusBatch ¶
WatchStatusBatch returns watch status for all movies that have been watched.
func (*Service) WatchStatusForMovie ¶
WatchStatusForMovie returns the watch status for a single movie.
type WatchStats ¶
type WatchStats struct {
WatchedCount int64 `json:"watched_count"`
TotalCount int64 `json:"total_count"`
Percentage float64 `json:"percentage"`
}
WatchStats is aggregate watch statistics.
type WatchStatus ¶
type WatchStatus struct {
Watched bool `json:"watched"`
PlayCount int64 `json:"play_count"`
LastWatchedAt *string `json:"last_watched_at,omitempty"`
}
WatchStatus is the derived watch state for a single movie.