Documentation
¶
Overview ¶
Package importlist manages import list configurations and syncs series from external sources (TMDb, Trakt, Plex, etc.) into the library.
Index ¶
- Variables
- type Config
- type CreateRequest
- type Exclusion
- type PreviewItem
- type Service
- func (s *Service) Create(ctx context.Context, req CreateRequest) (Config, error)
- func (s *Service) CreateExclusion(ctx context.Context, tmdbID int, title string, year int) (Exclusion, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) DeleteExclusion(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (Config, error)
- func (s *Service) List(ctx context.Context) ([]Config, error)
- func (s *Service) ListExclusions(ctx context.Context) ([]Exclusion, error)
- func (s *Service) Preview(ctx context.Context, kind string, settings json.RawMessage) ([]PreviewItem, error)
- func (s *Service) Sync(ctx context.Context) SyncResult
- func (s *Service) SyncOne(ctx context.Context, id string) SyncResult
- func (s *Service) Test(ctx context.Context, id string) error
- func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Config, error)
- type SyncResult
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("import list not found")
ErrNotFound is returned when an import list config does not exist.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Enabled bool `json:"enabled"`
Settings json.RawMessage `json:"settings"`
SearchOnAdd bool `json:"search_on_add"`
Monitor bool `json:"monitor"`
MonitorType string `json:"monitor_type"`
QualityProfileID string `json:"quality_profile_id"`
LibraryID string `json:"library_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Config is the domain representation of an import list configuration.
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name"`
Kind string `json:"kind"`
Enabled bool `json:"enabled"`
Settings json.RawMessage `json:"settings"`
SearchOnAdd bool `json:"search_on_add"`
Monitor bool `json:"monitor"`
MonitorType string `json:"monitor_type"`
QualityProfileID string `json:"quality_profile_id"`
LibraryID string `json:"library_id"`
}
CreateRequest holds the fields for creating an import list config.
type Exclusion ¶
type Exclusion struct {
ID string `json:"id"`
TMDbID int `json:"tmdb_id"`
Title string `json:"title"`
Year int `json:"year"`
CreatedAt time.Time `json:"created_at"`
}
Exclusion is a series excluded from import list syncs.
type PreviewItem ¶
type PreviewItem struct {
TMDbID int `json:"tmdb_id"`
Title string `json:"title"`
Year int `json:"year"`
PosterPath string `json:"poster_path,omitempty"`
}
PreviewItem is a single series from a list preview, including poster info.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages import list configurations and executes syncs.
func NewService ¶
func NewService( q db.Querier, reg *registry.Registry, showSvc *show.Service, tmdbClient *tmdbtv.Client, traktClient *trakt.Client, logger *slog.Logger, ) *Service
NewService creates a new import list Service. tmdbClient and traktClient may be nil.
func (*Service) CreateExclusion ¶
func (s *Service) CreateExclusion(ctx context.Context, tmdbID int, title string, year int) (Exclusion, error)
CreateExclusion adds a series to the import exclusion list.
func (*Service) DeleteExclusion ¶
DeleteExclusion removes an import exclusion by ID.
func (*Service) ListExclusions ¶
ListExclusions returns all import exclusions.
func (*Service) Preview ¶
func (s *Service) Preview(ctx context.Context, kind string, settings json.RawMessage) ([]PreviewItem, error)
Preview instantiates a plugin from the given kind + settings, fetches its items, and returns them as preview items (without adding anything to the library).
func (*Service) Sync ¶
func (s *Service) Sync(ctx context.Context) SyncResult
Sync fetches all enabled import lists and adds new series to the library. Returns immediately if a sync is already running.
func (*Service) SyncOne ¶
func (s *Service) SyncOne(ctx context.Context, id string) SyncResult
SyncOne syncs a single import list by ID.
type SyncResult ¶
type SyncResult struct {
ListsProcessed int `json:"lists_processed"`
SeriesAdded int `json:"series_added"`
SeriesSkipped int `json:"series_skipped"`
Errors []string `json:"errors"`
}
SyncResult summarises a completed import list sync.
type UpdateRequest ¶
type UpdateRequest = CreateRequest
UpdateRequest holds the fields for updating an import list config.