watchsync

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package watchsync ingests watch history from media servers and stores it locally for watch-aware library management.

Index

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

func (s *Service) Sync(ctx context.Context) error

Sync polls all configured media servers for new watch events and stores them.

func (*Service) WatchStatusBatch

func (s *Service) WatchStatusBatch(ctx context.Context) (map[string]*WatchStatus, error)

WatchStatusBatch returns watch status for all movies that have been watched.

func (*Service) WatchStatusForMovie

func (s *Service) WatchStatusForMovie(ctx context.Context, movieID string) (*WatchStatus, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL