Versions in this module Expand all Collapse all v0 v0.3.5 Nov 7, 2026 v0.3.4 Nov 5, 2026 Changes in this version + var ErrPMSAddress = errors.New("plexwatch: enter the server address, like http://192.168.1.10:32400") + var ErrPMSDifferentServer = errors.New("plexwatch: that address is a different Plex Media Server") + var ErrPMSDuplicate = errors.New("plexwatch: this Plex Media Server is already added") + var ErrPMSInvalid = errors.New("plexwatch: invalid server settings") + var ErrPMSLimit = errors.New("plexwatch: limit reached") + var ErrPMSNeedsToken = errors.New("plexwatch: sending to Plex for this person needs their token for this server") + var ErrPMSNotOwner = errors.New("plexwatch: this token is not the server owner's") + var ErrPMSToken = errors.New("plexwatch: the Plex Media Server refused this token") + var ErrPMSUnreachable = errors.New("plexwatch: the Plex Media Server could not be reached") + type PMSAccount struct + ID int64 + Name string + Owner bool + UserID int64 + type PMSCatalog interface + ByExternalIDForType func(ctx context.Context, source, id string, typ core.MediaType) (*core.Title, error) + Get func(ctx context.Context, key core.RatingKey) (*core.Title, error) + type PMSMapping struct + AccountID int64 + AccountName string + CanSend bool + Direction int + Interval int + LastImport int64 + LastSend int64 + NextSync int64 + Owner bool + Problem string + Unmatched int + UserID int64 + type PMSMappingInput struct + Direction int + Interval int + Token *string + UserID int64 + type PMSServer struct + CheckedAt int64 + ID int64 + MachineID string + Name string + Owner string + Problem string + URL string + Version string + Viewers []PMSMapping + type PMSUnmatched struct + Direction string + Reason string + Ref string + SeenAt int64 + Title string + type Servers struct + func NewServers(o ServersOptions) (*Servers, error) + func (s *Servers) Accounts(ctx context.Context, id int64) ([]PMSAccount, error) + func (s *Servers) Add(ctx context.Context, name, baseURL, token string) (PMSServer, error) + func (s *Servers) Close() error + func (s *Servers) List(ctx context.Context) ([]PMSServer, error) + func (s *Servers) MapAccount(ctx context.Context, id, accountID int64, in PMSMappingInput) (PMSServer, error) + func (s *Servers) Remove(ctx context.Context, id int64) error + func (s *Servers) Run(ctx context.Context) + func (s *Servers) RunOnce(ctx context.Context) + func (s *Servers) Server(ctx context.Context, id int64) (PMSServer, error) + func (s *Servers) SyncNow(ctx context.Context, id int64) (PMSServer, error) + func (s *Servers) Unmatched(ctx context.Context, id, userID int64, after string) ([]PMSUnmatched, error) + func (s *Servers) Update(ctx context.Context, id int64, name, baseURL, token string) (PMSServer, error) + type ServersOptions struct + Catalog PMSCatalog + ClientID string + DB *sql.DB + GUID GUIDMap + HTTP *http.Client + Logger *slog.Logger + Now func() time.Time + Sealer config.FieldSealer + State *state.State + ViewerExists func(context.Context, int64) (bool, error) v0.3.3 Nov 4, 2026 Changes in this version + const AccountSyncSupported + var ErrCredentialForbidden = errors.New("plexwatch: credential is not allowed to access watch state") + var ErrUnsupported = errors.New("plexwatch: Plex accepts watch-state sync only from its own servers") type Options + ServerIdentity func() (string, string) type Service + func (s *Service) RunImports(ctx context.Context) + func (s *Service) SetDirection(ctx context.Context, userID, plexID int64, direction, interval int) (Status, error) + func (s *Service) Supported() bool + func (s *Service) Unmatched(ctx context.Context, userID, plexID int64, after string) ([]string, error) type Status + Direction int + ImportInterval int + LastImport int64 + LastSend int64 + NextImport int64 + Problem string + ProblemCode int type StatusError + PlexCode int v0.3.2 Nov 3, 2026 v0.3.1 Nov 1, 2026 v0.3.0 Nov 1, 2026 Changes in this version type Service + func (s *Service) ReconcileOnce(ctx context.Context) (bool, error) + func (s *Service) Resolve(ctx context.Context, userID, plexID int64) (Status, error) type Status + Held int + HeldLegacy int v0.2.58 Oct 31, 2026 v0.2.57 Oct 31, 2026 Changes in this version + var ErrAccountMismatch = errors.New("plexwatch: plex account does not belong to this viewer") + var ErrNotEligible = errors.New("plexwatch: account has not allowed watch-state sync") + var ErrRevoked = errors.New("plexwatch: account token rejected") + type Client struct + type GUIDMap interface + ExactKey func(ctx context.Context, guid string) (core.RatingKey, error) + Resolve func(ctx context.Context, key core.RatingKey) (string, error) + type Options struct + BaseURL string + ClientID string + DB *sql.DB + GUID GUIDMap + HTTP *http.Client + Logger *slog.Logger + NodeID string + Now func() time.Time + Sealer config.FieldSealer + State *state.State + type Service struct + func New(opts Options) (*Service, error) + func (s *Service) BeginPIN(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) Close() error + func (s *Service) DeliverOnce(ctx context.Context) (bool, error) + func (s *Service) Disconnect(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) ExportCurrent(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) FinishPIN(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) ImportCurrent(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) ProbeToken(ctx context.Context, token string, plexID int64) (remoteAccount, error) + func (s *Service) Retry(ctx context.Context, userID, plexID int64) (Status, error) + func (s *Service) Run(ctx context.Context) + func (s *Service) SetEnabled(ctx context.Context, userID, plexID int64, on bool) (Status, error) + func (s *Service) Status(ctx context.Context, userID, plexID int64) (Status, error) + type Status struct + AccountMatch bool + Connected bool + Dead int + Eligibility string + Enabled bool + InFlight bool + PINCode string + PINExpires string + PINURL string + Pending int + PlexID int64 + Restricted bool + Revoked bool + Skipped int + Username string + type StatusError struct + Op string + RetryAfter time.Duration + Status int + func (e *StatusError) Error() string + func (e *StatusError) Is(target error) bool