model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathMatchFailed         = fmt.Errorf("path match failed")
	ErrEpisodeAlreadySatisfied = fmt.Errorf("item already satisfied by another file in ARR")
	ErrInstanceNotFound        = fmt.Errorf("instance not found")
)

Functions

func SonarrQueueIsReplacement

func SonarrQueueIsReplacement(row *sonarr.QueueRecord, failedDownloadID string) bool

SonarrQueueIsReplacement requires an active, distinct download. A lingering failed source row or another failed import is not replacement coverage.

Types

type AlbumMetadata

type AlbumMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type ArtistMetadata

type ArtistMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type AuthorMetadata

type AuthorMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type BookFileMetadata

type BookFileMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type BookMetadata

type BookMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type ConfigInstance

type ConfigInstance struct {
	APIVersion string `json:"api_version,omitempty"`
	Name       string `json:"name"`
	Type       string `json:"type"` // "radarr", "sonarr", "lidarr", "readarr", "whisparr", or "sportarr"
	URL        string `json:"url"`
	APIKey     string `json:"api_key"`
	Category   string `json:"category"`
	Enabled    bool   `json:"enabled"`
}

ConfigInstance represents an arrs instance from configuration

type ConfigManager

type ConfigManager interface {
	GetConfig() *config.Config
	GetConfigGetter() config.ConfigGetter
	UpdateConfig(config *config.Config) error
	SaveConfig() error
}

ConfigManager interface defines methods needed for configuration management

type EpisodeFileMetadata

type EpisodeFileMetadata struct {
	Id        int64  `json:"id,omitempty"`
	SceneName string `json:"sceneName,omitempty"`
}

type EpisodeMetadata

type EpisodeMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type HealthMediaIdentifiers

type HealthMediaIdentifiers struct {
	TMDBID       int64 `json:"tmdbId,omitempty"`
	TVDBID       int64 `json:"tvdbId,omitempty"`
	LegacyTMDBID int64 `json:"tmdb_id,omitempty"`
	LegacyTVDBID int64 `json:"tvdb_id,omitempty"`
}

HealthMediaIdentifiers accepts current and legacy names at either the root or the movie/series level. Integer fields reject fractional and string IDs.

type HealthMetadata

type HealthMetadata struct {
	HealthMediaIdentifiers
	Movie    *HealthMediaIdentifiers `json:"movie,omitempty"`
	Series   *HealthMediaIdentifiers `json:"series,omitempty"`
	Episodes []EpisodeMetadata       `json:"episodes,omitempty"`
}

HealthMetadata is the read model for persisted ARR webhook and Stremio metadata. Keep the producer-specific write models separate so reading legacy field names does not change the JSON written by either producer.

func DecodeHealthMetadata

func DecodeHealthMetadata(data string) (HealthMetadata, error)

func (HealthMetadata) MatchesTMDBID

func (m HealthMetadata) MatchesTMDBID(id int64) bool

func (HealthMetadata) MatchesTVDBID

func (m HealthMetadata) MatchesTVDBID(id int64) bool

func (HealthMetadata) NeedsDiscovery

func (m HealthMetadata) NeedsDiscovery() bool

NeedsDiscovery preserves ARR's episode discovery requirement while accepting valid flat identifiers from Stremio. Missing, null and nonpositive IDs cannot suppress discovery just because their JSON key is present.

type MovieFileMetadata

type MovieFileMetadata struct {
	Id        int64  `json:"id,omitempty"`
	SceneName string `json:"sceneName,omitempty"`
}

type MovieMetadata

type MovieMetadata struct {
	Id     int64 `json:"id,omitempty"`
	TmdbId int64 `json:"tmdbId,omitempty"`
}

type SeriesMetadata

type SeriesMetadata struct {
	Id     int64 `json:"id,omitempty"`
	TvdbId int64 `json:"tvdbId,omitempty"`
}

type SonarrDownloadGroup

type SonarrDownloadGroup struct {
	Record                 *sonarr.QueueRecord
	EpisodeIDs             []int64
	QueueIDs               []int64
	SeasonNumbers          []int
	IsFullSeason           *bool
	EpisodesWithFilesCount *int
}

SonarrDownloadGroup retains all episode targets and source queue identities. Optional pack hints deliberately distinguish absent metadata from false/zero.

func (SonarrDownloadGroup) Key

func (g SonarrDownloadGroup) Key() string

Key is instance-local; callers must also include their instance identity.

type SonarrEpisodeRepairState

type SonarrEpisodeRepairState struct {
	ID, FileID                                               int64
	Known, Monitored, Healthy, ReplacementPending, Exhausted bool
}

SonarrEpisodeRepairState describes one refreshed target. Healthy must be supplied by the caller; a pack's aggregate imported count cannot establish it.

type SonarrRemovalOptions

type SonarrRemovalOptions struct {
	RemoveFromClient bool
	ChangeCategory   bool
	Blocklist        bool
	Search           bool
}

func (SonarrRemovalOptions) Validate

func (o SonarrRemovalOptions) Validate() error

type SonarrRepairPlan

type SonarrRepairPlan struct {
	Satisfied, Covered, Search, GiveUp, Unknown, Ignored, FileIDs []int64
}

type SonarrRepairSnapshot

type SonarrRepairSnapshot struct{ Episodes []SonarrEpisodeRepairState }

type TrackFileMetadata

type TrackFileMetadata struct {
	Id int64 `json:"id,omitempty"`
}

type WebhookMetadata

type WebhookMetadata struct {
	DownloadID   string               `json:"downloadId,omitempty"`
	EventType    string               `json:"eventType,omitempty"`
	InstanceName string               `json:"instanceName,omitempty"`
	Movie        *MovieMetadata       `json:"movie,omitempty"`
	MovieFile    *MovieFileMetadata   `json:"movieFile,omitempty"`
	Series       *SeriesMetadata      `json:"series,omitempty"`
	EpisodeFile  *EpisodeFileMetadata `json:"episodeFile,omitempty"`
	Episodes     []EpisodeMetadata    `json:"episodes,omitempty"`
	Artist       *ArtistMetadata      `json:"artist,omitempty"`
	Album        *AlbumMetadata       `json:"album,omitempty"`
	TrackFile    *TrackFileMetadata   `json:"trackFile,omitempty"`
	Author       *AuthorMetadata      `json:"author,omitempty"`
	Book         *BookMetadata        `json:"book,omitempty"`
	BookFile     *BookFileMetadata    `json:"bookFile,omitempty"`
}

Jump to

Keyboard shortcuts

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