importlist

package
v0.0.0-...-d771ed5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package importlist manages import list configurations and syncs series from external sources (TMDb, Trakt, Plex, etc.) into the library.

Index

Constants

This section is empty.

Variables

View Source
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) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (Config, error)

Create adds a new import list configuration.

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) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete removes an import list config by ID.

func (*Service) DeleteExclusion

func (s *Service) DeleteExclusion(ctx context.Context, id string) error

DeleteExclusion removes an import exclusion by ID.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Config, error)

Get returns an import list config by ID.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Config, error)

List returns all import list configs, ordered by name.

func (*Service) ListExclusions

func (s *Service) ListExclusions(ctx context.Context) ([]Exclusion, error)

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.

func (*Service) Test

func (s *Service) Test(ctx context.Context, id string) error

Test validates that the import list plugin can connect to its source.

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Config, error)

Update modifies an existing import list config.

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.

Jump to

Keyboard shortcuts

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