domain

package
v1.50.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: GPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DownloadClientAuthTypeNone   = "NONE"
	DownloadClientAuthTypeBasic  = "BASIC_AUTH"
	DownloadClientAuthTypeDigest = "DIGEST_AUTH"
)
View Source
const (
	EventReleaseStoreActionStatus = "release:store-action-status"
	EventReleasePushStatus        = "release:push"
	EventNotificationSend         = "events:notification"
	EventIndexerDelete            = "indexer:delete"
)
View Source
const MagnetURIPrefix = "magnet:?"
View Source
const (
	ProxyTypeSocks5 = "SOCKS5"
)

Variables

View Source
var (
	ErrRecordNotFound = sql.ErrNoRows
	ErrUpdateFailed   = errors.New("update failed")
	ErrDeleteFailed   = errors.New("delete failed")
)

Functions

func CleanReleaseTags added in v1.36.0

func CleanReleaseTags(tagString string) string

CleanReleaseTags trim delimiters and closest space

func SplitAny

func SplitAny(s string, seps string) []string

func StringEqualFoldMulti

func StringEqualFoldMulti(s string, values ...string) bool

func ValidReleasePushStatus added in v1.32.0

func ValidReleasePushStatus(s string) bool

func ValidateProxyAddr added in v1.46.0

func ValidateProxyAddr(addr string) error

Types

type APIKey

type APIKey struct {
	Name      string    `json:"name"`
	Key       string    `json:"key"`
	Scopes    []string  `json:"scopes"`
	CreatedAt time.Time `json:"created_at"`
}

type APIRepo

type APIRepo interface {
	Store(ctx context.Context, key *APIKey) error
	Delete(ctx context.Context, key string) error
	GetAllAPIKeys(ctx context.Context) ([]APIKey, error)
	GetKey(ctx context.Context, key string) (*APIKey, error)
}

type Action

type Action struct {
	ID                       int                 `json:"id"`
	Name                     string              `json:"name"`
	Type                     ActionType          `json:"type"`
	Enabled                  bool                `json:"enabled"`
	ExecCmd                  string              `json:"exec_cmd,omitempty"`
	ExecArgs                 string              `json:"exec_args,omitempty"`
	WatchFolder              string              `json:"watch_folder,omitempty"`
	Category                 string              `json:"category,omitempty"`
	Tags                     string              `json:"tags,omitempty"`
	Label                    string              `json:"label,omitempty"`
	SavePath                 string              `json:"save_path,omitempty"`
	Paused                   bool                `json:"paused,omitempty"`
	IgnoreRules              bool                `json:"ignore_rules,omitempty"`
	FirstLastPiecePrio       bool                `json:"first_last_piece_prio,omitempty"`
	SkipHashCheck            bool                `json:"skip_hash_check,omitempty"`
	ContentLayout            ActionContentLayout `json:"content_layout,omitempty"`
	LimitUploadSpeed         int64               `json:"limit_upload_speed,omitempty"`
	LimitDownloadSpeed       int64               `json:"limit_download_speed,omitempty"`
	LimitRatio               float64             `json:"limit_ratio,omitempty"`
	LimitSeedTime            int64               `json:"limit_seed_time,omitempty"`
	PriorityLayout           PriorityLayout      `json:"priority,omitempty"`
	ReAnnounceSkip           bool                `json:"reannounce_skip,omitempty"`
	ReAnnounceDelete         bool                `json:"reannounce_delete,omitempty"`
	ReAnnounceInterval       int64               `json:"reannounce_interval,omitempty"`
	ReAnnounceMaxAttempts    int64               `json:"reannounce_max_attempts,omitempty"`
	WebhookHost              string              `json:"webhook_host,omitempty"`
	WebhookType              string              `json:"webhook_type,omitempty"`
	WebhookMethod            string              `json:"webhook_method,omitempty"`
	WebhookData              string              `json:"webhook_data,omitempty"`
	WebhookHeaders           []string            `json:"webhook_headers,omitempty"`
	ExternalDownloadClientID int32               `json:"external_download_client_id,omitempty"`
	ExternalDownloadClient   string              `json:"external_download_client,omitempty"`
	FilterID                 int                 `json:"filter_id,omitempty"`
	ClientID                 int32               `json:"client_id,omitempty"`
	Client                   *DownloadClient     `json:"client,omitempty"`
}

func (*Action) CheckMacrosNeedRawDataBytes added in v1.46.0

func (a *Action) CheckMacrosNeedRawDataBytes(release *Release) bool

func (*Action) CheckMacrosNeedTorrentTmpFile added in v1.46.0

func (a *Action) CheckMacrosNeedTorrentTmpFile(release *Release) bool

CheckMacrosNeedTorrentTmpFile check if macros needs torrent downloaded

func (*Action) ParseMacros

func (a *Action) ParseMacros(release *Release) error

ParseMacros parse all macros on action

type ActionContentLayout

type ActionContentLayout string
const (
	ActionContentLayoutOriginal        ActionContentLayout = "ORIGINAL"
	ActionContentLayoutSubfolderNone   ActionContentLayout = "SUBFOLDER_NONE"
	ActionContentLayoutSubfolderCreate ActionContentLayout = "SUBFOLDER_CREATE"
)

type ActionRepo

type ActionRepo interface {
	Store(ctx context.Context, action Action) (*Action, error)
	StoreFilterActions(ctx context.Context, filterID int64, actions []*Action) ([]*Action, error)
	FindByFilterID(ctx context.Context, filterID int, active *bool, withClient bool) ([]*Action, error)
	List(ctx context.Context) ([]Action, error)
	Get(ctx context.Context, req *GetActionRequest) (*Action, error)
	Delete(ctx context.Context, req *DeleteActionRequest) error
	DeleteByFilterID(ctx context.Context, filterID int) error
	ToggleEnabled(actionID int) error
}

type ActionType

type ActionType string
const (
	ActionTypeTest         ActionType = "TEST"
	ActionTypeExec         ActionType = "EXEC"
	ActionTypeQbittorrent  ActionType = "QBITTORRENT"
	ActionTypeDelugeV1     ActionType = "DELUGE_V1"
	ActionTypeDelugeV2     ActionType = "DELUGE_V2"
	ActionTypeRTorrent     ActionType = "RTORRENT"
	ActionTypeTransmission ActionType = "TRANSMISSION"
	ActionTypePorla        ActionType = "PORLA"
	ActionTypeWatchFolder  ActionType = "WATCH_FOLDER"
	ActionTypeWebhook      ActionType = "WEBHOOK"
	ActionTypeRadarr       ActionType = "RADARR"
	ActionTypeSonarr       ActionType = "SONARR"
	ActionTypeLidarr       ActionType = "LIDARR"
	ActionTypeWhisparr     ActionType = "WHISPARR"
	ActionTypeReadarr      ActionType = "READARR"
	ActionTypeSabnzbd      ActionType = "SABNZBD"
)

type BasicAuth

type BasicAuth struct {
	Auth     bool   `json:"auth,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type ChannelHealth

type ChannelHealth struct {
	Name            string    `json:"name"`
	Monitoring      bool      `json:"monitoring"`
	MonitoringSince time.Time `json:"monitoring_since"`
	LastAnnounce    time.Time `json:"last_announce"`
}

type ChannelWithHealth

type ChannelWithHealth struct {
	ID              int64     `json:"id"`
	Enabled         bool      `json:"enabled"`
	Name            string    `json:"name"`
	Password        string    `json:"password"`
	Detached        bool      `json:"detached"`
	Monitoring      bool      `json:"monitoring"`
	MonitoringSince time.Time `json:"monitoring_since"`
	LastAnnounce    time.Time `json:"last_announce"`
}

type Config

type Config struct {
	Version             string
	ConfigPath          string
	Host                string `toml:"host"`
	Port                int    `toml:"port"`
	LogLevel            string `toml:"logLevel"`
	LogPath             string `toml:"logPath"`
	LogMaxSize          int    `toml:"logMaxSize"`
	LogMaxBackups       int    `toml:"logMaxBackups"`
	BaseURL             string `toml:"baseUrl"`
	SessionSecret       string `toml:"sessionSecret"`
	CustomDefinitions   string `toml:"customDefinitions"`
	CheckForUpdates     bool   `toml:"checkForUpdates"`
	DatabaseType        string `toml:"databaseType"`
	PostgresHost        string `toml:"postgresHost"`
	PostgresPort        int    `toml:"postgresPort"`
	PostgresDatabase    string `toml:"postgresDatabase"`
	PostgresUser        string `toml:"postgresUser"`
	PostgresPass        string `toml:"postgresPass"`
	PostgresSSLMode     string `toml:"postgresSSLMode"`
	PostgresExtraParams string `toml:"postgresExtraParams"`
	ProfilingEnabled    bool   `toml:"profilingEnabled"`
	ProfilingHost       string `toml:"profilingHost"`
	ProfilingPort       int    `toml:"profilingPort"`
}

type ConfigUpdate

type ConfigUpdate struct {
	Host            *string `json:"host,omitempty"`
	Port            *int    `json:"port,omitempty"`
	LogLevel        *string `json:"log_level,omitempty"`
	LogPath         *string `json:"log_path,omitempty"`
	BaseURL         *string `json:"base_url,omitempty"`
	CheckForUpdates *bool   `json:"check_for_updates,omitempty"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type DeleteActionRequest added in v1.26.0

type DeleteActionRequest struct {
	ActionId int
}

type DeleteReleaseRequest added in v1.28.0

type DeleteReleaseRequest struct {
	OlderThan       int
	Indexers        []string
	ReleaseStatuses []string
}

type DownloadClient

type DownloadClient struct {
	ID            int32                  `json:"id"`
	Name          string                 `json:"name"`
	Type          DownloadClientType     `json:"type"`
	Enabled       bool                   `json:"enabled"`
	Host          string                 `json:"host"`
	Port          int                    `json:"port"`
	TLS           bool                   `json:"tls"`
	TLSSkipVerify bool                   `json:"tls_skip_verify"`
	Username      string                 `json:"username"`
	Password      string                 `json:"password"`
	Settings      DownloadClientSettings `json:"settings,omitempty"`

	// cached http client
	Client any
}

func (DownloadClient) BuildLegacyHost

func (c DownloadClient) BuildLegacyHost() string

func (DownloadClient) Validate

func (c DownloadClient) Validate() error

Validate basic validation of client

type DownloadClientAuth added in v1.46.0

type DownloadClientAuth struct {
	Enabled  bool                   `json:"enabled,omitempty"`
	Type     DownloadClientAuthType `json:"type,omitempty"`
	Username string                 `json:"username,omitempty"`
	Password string                 `json:"password,omitempty"`
}

type DownloadClientAuthType added in v1.46.0

type DownloadClientAuthType string

type DownloadClientRepo

type DownloadClientRepo interface {
	List(ctx context.Context) ([]DownloadClient, error)
	FindByID(ctx context.Context, id int32) (*DownloadClient, error)
	Store(ctx context.Context, client *DownloadClient) error
	Update(ctx context.Context, client *DownloadClient) error
	Delete(ctx context.Context, clientID int32) error
}

type DownloadClientRules

type DownloadClientRules struct {
	Enabled                     bool                        `json:"enabled"`
	MaxActiveDownloads          int                         `json:"max_active_downloads"`
	IgnoreSlowTorrents          bool                        `json:"ignore_slow_torrents"`
	IgnoreSlowTorrentsCondition IgnoreSlowTorrentsCondition `json:"ignore_slow_torrents_condition,omitempty"`
	DownloadSpeedThreshold      int64                       `json:"download_speed_threshold"`
	UploadSpeedThreshold        int64                       `json:"upload_speed_threshold"`
}

type DownloadClientSettings

type DownloadClientSettings struct {
	APIKey                   string              `json:"apikey,omitempty"`
	Basic                    BasicAuth           `json:"basic,omitempty"` // Deprecated: Use Auth instead
	Rules                    DownloadClientRules `json:"rules,omitempty"`
	ExternalDownloadClientId int                 `json:"external_download_client_id,omitempty"`
	ExternalDownloadClient   string              `json:"external_download_client,omitempty"`
	Auth                     DownloadClientAuth  `json:"auth,omitempty"`
}

func (*DownloadClientSettings) MarshalJSON added in v1.46.0

func (dcs *DownloadClientSettings) MarshalJSON() ([]byte, error)

MarshalJSON Custom method to translate Basic into Auth without including Basic in JSON output

func (*DownloadClientSettings) UnmarshalJSON added in v1.46.0

func (dcs *DownloadClientSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON Custom method to translate Basic into Auth

type DownloadClientType

type DownloadClientType string
const (
	DownloadClientTypeQbittorrent  DownloadClientType = "QBITTORRENT"
	DownloadClientTypeDelugeV1     DownloadClientType = "DELUGE_V1"
	DownloadClientTypeDelugeV2     DownloadClientType = "DELUGE_V2"
	DownloadClientTypeRTorrent     DownloadClientType = "RTORRENT"
	DownloadClientTypeTransmission DownloadClientType = "TRANSMISSION"
	DownloadClientTypePorla        DownloadClientType = "PORLA"
	DownloadClientTypeRadarr       DownloadClientType = "RADARR"
	DownloadClientTypeSonarr       DownloadClientType = "SONARR"
	DownloadClientTypeLidarr       DownloadClientType = "LIDARR"
	DownloadClientTypeWhisparr     DownloadClientType = "WHISPARR"
	DownloadClientTypeReadarr      DownloadClientType = "READARR"
	DownloadClientTypeSabnzbd      DownloadClientType = "SABNZBD"
)

type DownloadTorrentFileResponse

type DownloadTorrentFileResponse struct {
	MetaInfo    *metainfo.MetaInfo
	TmpFileName string
}

type EventsReleasePushed

type EventsReleasePushed struct {
	ReleaseName    string
	Filter         string
	Indexer        string
	InfoHash       string
	Size           uint64
	Status         ReleasePushStatus
	Action         string
	ActionType     ActionType
	ActionClient   string
	Rejections     []string
	Protocol       ReleaseProtocol       // torrent, usenet
	Implementation ReleaseImplementation // irc, rss, api
	Timestamp      time.Time
}

type Feed

type Feed struct {
	ID           int               `json:"id"`
	Name         string            `json:"name"`
	Indexer      IndexerMinimal    `json:"indexer"`
	Type         string            `json:"type"`
	Enabled      bool              `json:"enabled"`
	URL          string            `json:"url"`
	Interval     int               `json:"interval"`
	Timeout      int               `json:"timeout"` // seconds
	MaxAge       int               `json:"max_age"` // seconds
	Capabilities []string          `json:"capabilities"`
	ApiKey       string            `json:"api_key"`
	Cookie       string            `json:"cookie"`
	Settings     *FeedSettingsJSON `json:"settings"`
	CreatedAt    time.Time         `json:"created_at"`
	UpdatedAt    time.Time         `json:"updated_at"`
	IndexerID    int               `json:"indexer_id,omitempty"`
	LastRun      time.Time         `json:"last_run"`
	LastRunData  string            `json:"last_run_data"`
	NextRun      time.Time         `json:"next_run"`

	// belongs to Indexer
	ProxyID  int64
	UseProxy bool
	Proxy    *Proxy
}

type FeedCacheItem

type FeedCacheItem struct {
	FeedId string    `json:"feed_id"`
	Key    string    `json:"key"`
	Value  []byte    `json:"value"`
	TTL    time.Time `json:"ttl"`
}

type FeedCacheRepo

type FeedCacheRepo interface {
	Get(feedId int, key string) ([]byte, error)
	GetByFeed(ctx context.Context, feedId int) ([]FeedCacheItem, error)
	GetCountByFeed(ctx context.Context, feedId int) (int, error)
	Exists(feedId int, key string) (bool, error)
	Put(feedId int, key string, val []byte, ttl time.Time) error
	PutMany(ctx context.Context, items []FeedCacheItem) error
	Delete(ctx context.Context, feedId int, key string) error
	DeleteByFeed(ctx context.Context, feedId int) error
	DeleteStale(ctx context.Context) error
}

type FeedDownloadType

type FeedDownloadType string
const (
	FeedDownloadTypeMagnet  FeedDownloadType = "MAGNET"
	FeedDownloadTypeTorrent FeedDownloadType = "TORRENT"
)

type FeedIndexer

type FeedIndexer struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	Identifier string `json:"identifier"`
}

type FeedRepo

type FeedRepo interface {
	FindOne(ctx context.Context, params FindOneParams) (*Feed, error)
	FindByID(ctx context.Context, id int) (*Feed, error)
	Find(ctx context.Context) ([]Feed, error)
	GetLastRunDataByID(ctx context.Context, id int) (string, error)
	Store(ctx context.Context, feed *Feed) error
	Update(ctx context.Context, feed *Feed) error
	UpdateLastRun(ctx context.Context, feedID int) error
	UpdateLastRunWithData(ctx context.Context, feedID int, data string) error
	ToggleEnabled(ctx context.Context, id int, enabled bool) error
	Delete(ctx context.Context, id int) error
}

type FeedSettings

type FeedSettings struct {
	MinInterval int              `json:"minInterval"`
	Settings    []IndexerSetting `json:"settings"`
}

type FeedSettingsJSON

type FeedSettingsJSON struct {
	DownloadType FeedDownloadType `json:"download_type"`
}

type FeedType

type FeedType string
const (
	FeedTypeTorznab FeedType = "TORZNAB"
	FeedTypeNewznab FeedType = "NEWZNAB"
	FeedTypeRSS     FeedType = "RSS"
)

type Filter

type Filter struct {
	ID                   int                    `json:"id"`
	Name                 string                 `json:"name"`
	Enabled              bool                   `json:"enabled"`
	CreatedAt            time.Time              `json:"created_at"`
	UpdatedAt            time.Time              `json:"updated_at"`
	MinSize              string                 `json:"min_size,omitempty"`
	MaxSize              string                 `json:"max_size,omitempty"`
	Delay                int                    `json:"delay,omitempty"`
	Priority             int32                  `json:"priority"`
	MaxDownloads         int                    `json:"max_downloads,omitempty"`
	MaxDownloadsUnit     FilterMaxDownloadsUnit `json:"max_downloads_unit,omitempty"`
	MatchReleases        string                 `json:"match_releases,omitempty"`
	ExceptReleases       string                 `json:"except_releases,omitempty"`
	UseRegex             bool                   `json:"use_regex,omitempty"`
	MatchReleaseGroups   string                 `json:"match_release_groups,omitempty"`
	ExceptReleaseGroups  string                 `json:"except_release_groups,omitempty"`
	Scene                bool                   `json:"scene,omitempty"`
	Origins              []string               `json:"origins,omitempty"`
	ExceptOrigins        []string               `json:"except_origins,omitempty"`
	Bonus                []string               `json:"bonus,omitempty"`
	Freeleech            bool                   `json:"freeleech,omitempty"`
	FreeleechPercent     string                 `json:"freeleech_percent,omitempty"`
	SmartEpisode         bool                   `json:"smart_episode"`
	Shows                string                 `json:"shows,omitempty"`
	Seasons              string                 `json:"seasons,omitempty"`
	Episodes             string                 `json:"episodes,omitempty"`
	Resolutions          []string               `json:"resolutions,omitempty"` // SD, 480i, 480p, 576p, 720p, 810p, 1080i, 1080p.
	Codecs               []string               `json:"codecs,omitempty"`      // XviD, DivX, x264, h.264 (or h264), mpeg2 (or mpeg-2), VC-1 (or VC1), WMV, Remux, h.264 Remux (or h264 Remux), VC-1 Remux (or VC1 Remux).
	Sources              []string               `json:"sources,omitempty"`     // DSR, PDTV, HDTV, HR.PDTV, HR.HDTV, DVDRip, DVDScr, BDr, BD5, BD9, BDRip, BRRip, DVDR, MDVDR, HDDVD, HDDVDRip, BluRay, WEB-DL, TVRip, CAM, R5, TELESYNC, TS, TELECINE, TC. TELESYNC and TS are synonyms (you don't need both). Same for TELECINE and TC
	Containers           []string               `json:"containers,omitempty"`
	MatchHDR             []string               `json:"match_hdr,omitempty"`
	ExceptHDR            []string               `json:"except_hdr,omitempty"`
	MatchOther           []string               `json:"match_other,omitempty"`
	ExceptOther          []string               `json:"except_other,omitempty"`
	Years                string                 `json:"years,omitempty"`
	Months               string                 `json:"months,omitempty"`
	Days                 string                 `json:"days,omitempty"`
	Artists              string                 `json:"artists,omitempty"`
	Albums               string                 `json:"albums,omitempty"`
	MatchReleaseTypes    []string               `json:"match_release_types,omitempty"` // Album,Single,EP
	ExceptReleaseTypes   string                 `json:"except_release_types,omitempty"`
	Formats              []string               `json:"formats,omitempty"` // MP3, FLAC, Ogg, AAC, AC3, DTS
	Quality              []string               `json:"quality,omitempty"` // 192, 320, APS (VBR), V2 (VBR), V1 (VBR), APX (VBR), V0 (VBR), q8.x (VBR), Lossless, 24bit Lossless, Other
	Media                []string               `json:"media,omitempty"`   // CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, Other
	PerfectFlac          bool                   `json:"perfect_flac,omitempty"`
	Cue                  bool                   `json:"cue,omitempty"`
	Log                  bool                   `json:"log,omitempty"`
	LogScore             int                    `json:"log_score,omitempty"`
	MatchCategories      string                 `json:"match_categories,omitempty"`
	ExceptCategories     string                 `json:"except_categories,omitempty"`
	MatchUploaders       string                 `json:"match_uploaders,omitempty"`
	ExceptUploaders      string                 `json:"except_uploaders,omitempty"`
	MatchLanguage        []string               `json:"match_language,omitempty"`
	ExceptLanguage       []string               `json:"except_language,omitempty"`
	Tags                 string                 `json:"tags,omitempty"`
	ExceptTags           string                 `json:"except_tags,omitempty"`
	TagsAny              string                 `json:"tags_any,omitempty"`
	ExceptTagsAny        string                 `json:"except_tags_any,omitempty"`
	TagsMatchLogic       string                 `json:"tags_match_logic,omitempty"`
	ExceptTagsMatchLogic string                 `json:"except_tags_match_logic,omitempty"`
	MatchReleaseTags     string                 `json:"match_release_tags,omitempty"`
	ExceptReleaseTags    string                 `json:"except_release_tags,omitempty"`
	UseRegexReleaseTags  bool                   `json:"use_regex_release_tags,omitempty"`
	MatchDescription     string                 `json:"match_description,omitempty"`
	ExceptDescription    string                 `json:"except_description,omitempty"`
	UseRegexDescription  bool                   `json:"use_regex_description,omitempty"`
	MinSeeders           int                    `json:"min_seeders,omitempty"`
	MaxSeeders           int                    `json:"max_seeders,omitempty"`
	MinLeechers          int                    `json:"min_leechers,omitempty"`
	MaxLeechers          int                    `json:"max_leechers,omitempty"`
	ActionsCount         int                    `json:"actions_count"`
	ActionsEnabledCount  int                    `json:"actions_enabled_count"`
	Actions              []*Action              `json:"actions,omitempty"`
	External             []FilterExternal       `json:"external,omitempty"`
	Indexers             []Indexer              `json:"indexers"`
	Downloads            *FilterDownloads       `json:"-"`
	Rejections           []string               `json:"-"`
	RejectReasons        *RejectionReasons      `json:"-"`
}

func (*Filter) CheckFilter

func (f *Filter) CheckFilter(r *Release) (*RejectionReasons, bool)

func (*Filter) CheckReleaseSize added in v1.34.0

func (f *Filter) CheckReleaseSize(releaseSize uint64) (bool, error)

func (*Filter) IsPerfectFLAC added in v1.36.0

func (f *Filter) IsPerfectFLAC(r *Release) ([]string, bool)

IsPerfectFLAC Perfect is "CD FLAC Cue Log 100% Lossless or 24bit Lossless"

func (*Filter) Sanitize added in v1.41.0

func (f *Filter) Sanitize() error

func (*Filter) Validate added in v1.34.0

func (f *Filter) Validate() error

type FilterDownloads

type FilterDownloads struct {
	HourCount  int
	DayCount   int
	WeekCount  int
	MonthCount int
	TotalCount int
}

func (*FilterDownloads) String added in v1.48.0

func (f *FilterDownloads) String() string

type FilterExternal added in v1.29.0

type FilterExternal struct {
	ID                       int                `json:"id"`
	Name                     string             `json:"name"`
	Index                    int                `json:"index"`
	Type                     FilterExternalType `json:"type"`
	Enabled                  bool               `json:"enabled"`
	ExecCmd                  string             `json:"exec_cmd,omitempty"`
	ExecArgs                 string             `json:"exec_args,omitempty"`
	ExecExpectStatus         int                `json:"exec_expect_status,omitempty"`
	WebhookHost              string             `json:"webhook_host,omitempty"`
	WebhookMethod            string             `json:"webhook_method,omitempty"`
	WebhookData              string             `json:"webhook_data,omitempty"`
	WebhookHeaders           string             `json:"webhook_headers,omitempty"`
	WebhookExpectStatus      int                `json:"webhook_expect_status,omitempty"`
	WebhookRetryStatus       string             `json:"webhook_retry_status,omitempty"`
	WebhookRetryAttempts     int                `json:"webhook_retry_attempts,omitempty"`
	WebhookRetryDelaySeconds int                `json:"webhook_retry_delay_seconds,omitempty"`
	FilterId                 int                `json:"-"`
}

func (FilterExternal) NeedTorrentDownloaded added in v1.46.0

func (f FilterExternal) NeedTorrentDownloaded() bool

type FilterExternalType added in v1.29.0

type FilterExternalType string
const (
	ExternalFilterTypeExec    FilterExternalType = "EXEC"
	ExternalFilterTypeWebhook FilterExternalType = "WEBHOOK"
)

type FilterMaxDownloadsUnit

type FilterMaxDownloadsUnit string
const (
	FilterMaxDownloadsHour  FilterMaxDownloadsUnit = "HOUR"
	FilterMaxDownloadsDay   FilterMaxDownloadsUnit = "DAY"
	FilterMaxDownloadsWeek  FilterMaxDownloadsUnit = "WEEK"
	FilterMaxDownloadsMonth FilterMaxDownloadsUnit = "MONTH"
	FilterMaxDownloadsEver  FilterMaxDownloadsUnit = "EVER"
)

type FilterQueryParams

type FilterQueryParams struct {
	Sort    map[string]string
	Filters struct {
		Indexers []string
	}
	Search string
}

type FilterRepo

type FilterRepo interface {
	ListFilters(ctx context.Context) ([]Filter, error)
	Find(ctx context.Context, params FilterQueryParams) ([]Filter, error)
	FindByID(ctx context.Context, filterID int) (*Filter, error)
	FindByIndexerIdentifier(ctx context.Context, indexer string) ([]*Filter, error)
	FindExternalFiltersByID(ctx context.Context, filterId int) ([]FilterExternal, error)
	Store(ctx context.Context, filter *Filter) error
	Update(ctx context.Context, filter *Filter) error
	UpdatePartial(ctx context.Context, filter FilterUpdate) error
	ToggleEnabled(ctx context.Context, filterID int, enabled bool) error
	Delete(ctx context.Context, filterID int) error
	StoreIndexerConnection(ctx context.Context, filterID int, indexerID int) error
	StoreIndexerConnections(ctx context.Context, filterID int, indexers []Indexer) error
	StoreFilterExternal(ctx context.Context, filterID int, externalFilters []FilterExternal) error
	DeleteIndexerConnections(ctx context.Context, filterID int) error
	DeleteFilterExternal(ctx context.Context, filterID int) error
	GetDownloadsByFilterId(ctx context.Context, filterID int) (*FilterDownloads, error)
}

type FilterUpdate

type FilterUpdate struct {
	ID                   int                     `json:"id"`
	Name                 *string                 `json:"name,omitempty"`
	Enabled              *bool                   `json:"enabled,omitempty"`
	MinSize              *string                 `json:"min_size,omitempty"`
	MaxSize              *string                 `json:"max_size,omitempty"`
	Delay                *int                    `json:"delay,omitempty"`
	Priority             *int32                  `json:"priority,omitempty"`
	MaxDownloads         *int                    `json:"max_downloads,omitempty"`
	MaxDownloadsUnit     *FilterMaxDownloadsUnit `json:"max_downloads_unit,omitempty"`
	MatchReleases        *string                 `json:"match_releases,omitempty"`
	ExceptReleases       *string                 `json:"except_releases,omitempty"`
	UseRegex             *bool                   `json:"use_regex,omitempty"`
	MatchReleaseGroups   *string                 `json:"match_release_groups,omitempty"`
	ExceptReleaseGroups  *string                 `json:"except_release_groups,omitempty"`
	MatchReleaseTags     *string                 `json:"match_release_tags,omitempty"`
	ExceptReleaseTags    *string                 `json:"except_release_tags,omitempty"`
	UseRegexReleaseTags  *bool                   `json:"use_regex_release_tags,omitempty"`
	MatchDescription     *string                 `json:"match_description,omitempty"`
	ExceptDescription    *string                 `json:"except_description,omitempty"`
	UseRegexDescription  *bool                   `json:"use_regex_description,omitempty"`
	Scene                *bool                   `json:"scene,omitempty"`
	Origins              *[]string               `json:"origins,omitempty"`
	ExceptOrigins        *[]string               `json:"except_origins,omitempty"`
	Bonus                *[]string               `json:"bonus,omitempty"`
	Freeleech            *bool                   `json:"freeleech,omitempty"`
	FreeleechPercent     *string                 `json:"freeleech_percent,omitempty"`
	SmartEpisode         *bool                   `json:"smart_episode,omitempty"`
	Shows                *string                 `json:"shows,omitempty"`
	Seasons              *string                 `json:"seasons,omitempty"`
	Episodes             *string                 `json:"episodes,omitempty"`
	Resolutions          *[]string               `json:"resolutions,omitempty"` // SD, 480i, 480p, 576p, 720p, 810p, 1080i, 1080p.
	Codecs               *[]string               `json:"codecs,omitempty"`      // XviD, DivX, x264, h.264 (or h264), mpeg2 (or mpeg-2), VC-1 (or VC1), WMV, Remux, h.264 Remux (or h264 Remux), VC-1 Remux (or VC1 Remux).
	Sources              *[]string               `json:"sources,omitempty"`     // DSR, PDTV, HDTV, HR.PDTV, HR.HDTV, DVDRip, DVDScr, BDr, BD5, BD9, BDRip, BRRip, DVDR, MDVDR, HDDVD, HDDVDRip, BluRay, WEB-DL, TVRip, CAM, R5, TELESYNC, TS, TELECINE, TC. TELESYNC and TS are synonyms (you don't need both). Same for TELECINE and TC
	Containers           *[]string               `json:"containers,omitempty"`
	MatchHDR             *[]string               `json:"match_hdr,omitempty"`
	ExceptHDR            *[]string               `json:"except_hdr,omitempty"`
	MatchOther           *[]string               `json:"match_other,omitempty"`
	ExceptOther          *[]string               `json:"except_other,omitempty"`
	Years                *string                 `json:"years,omitempty"`
	Months               *string                 `json:"months,omitempty"`
	Days                 *string                 `json:"days,omitempty"`
	Artists              *string                 `json:"artists,omitempty"`
	Albums               *string                 `json:"albums,omitempty"`
	MatchReleaseTypes    *[]string               `json:"match_release_types,omitempty"` // Album,Single,EP
	ExceptReleaseTypes   *string                 `json:"except_release_types,omitempty"`
	Formats              *[]string               `json:"formats,omitempty"` // MP3, FLAC, Ogg, AAC, AC3, DTS
	Quality              *[]string               `json:"quality,omitempty"` // 192, 320, APS (VBR), V2 (VBR), V1 (VBR), APX (VBR), V0 (VBR), q8.x (VBR), Lossless, 24bit Lossless, Other
	Media                *[]string               `json:"media,omitempty"`   // CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, Other
	PerfectFlac          *bool                   `json:"perfect_flac,omitempty"`
	Cue                  *bool                   `json:"cue,omitempty"`
	Log                  *bool                   `json:"log,omitempty"`
	LogScore             *int                    `json:"log_score,omitempty"`
	MatchCategories      *string                 `json:"match_categories,omitempty"`
	ExceptCategories     *string                 `json:"except_categories,omitempty"`
	MatchUploaders       *string                 `json:"match_uploaders,omitempty"`
	ExceptUploaders      *string                 `json:"except_uploaders,omitempty"`
	MatchLanguage        *[]string               `json:"match_language,omitempty"`
	ExceptLanguage       *[]string               `json:"except_language,omitempty"`
	Tags                 *string                 `json:"tags,omitempty"`
	ExceptTags           *string                 `json:"except_tags,omitempty"`
	TagsAny              *string                 `json:"tags_any,omitempty"`
	ExceptTagsAny        *string                 `json:"except_tags_any,omitempty"`
	TagsMatchLogic       *string                 `json:"tags_match_logic,omitempty"`
	ExceptTagsMatchLogic *string                 `json:"except_tags_match_logic,omitempty"`
	MinSeeders           *int                    `json:"min_seeders,omitempty"`
	MaxSeeders           *int                    `json:"max_seeders,omitempty"`
	MinLeechers          *int                    `json:"min_leechers,omitempty"`
	MaxLeechers          *int                    `json:"max_leechers,omitempty"`
	Actions              []*Action               `json:"actions,omitempty"`
	External             []FilterExternal        `json:"external,omitempty"`
	Indexers             []Indexer               `json:"indexers,omitempty"`
}

type FindFunc

type FindFunc func(string) *TagInfo

FindFunc is the find signature..

func Find

func Find(infos ...*TagInfo) FindFunc

Find returns a func to find tag info.

type FindOneParams added in v1.49.0

type FindOneParams struct {
	FeedID            int
	IndexerID         int
	IndexerIdentifier string
}

type FindReleasesResponse added in v1.46.0

type FindReleasesResponse struct {
	Data       []*Release `json:"data"`
	TotalCount uint64     `json:"count"`
	NextCursor int64      `json:"next_cursor"`
}

type GetActionRequest added in v1.26.0

type GetActionRequest struct {
	Id int
}

type GetIndexerRequest added in v1.45.0

type GetIndexerRequest struct {
	ID         int
	Identifier string
	Name       string
}

type GetReleaseActionStatusRequest added in v1.26.0

type GetReleaseActionStatusRequest struct {
	Id int
}

type GetReleaseRequest added in v1.26.0

type GetReleaseRequest struct {
	Id int
}

type IRCAuth

type IRCAuth struct {
	Mechanism IRCAuthMechanism `json:"mechanism,omitempty"`
	Account   string           `json:"account,omitempty"`
	Password  string           `json:"password,omitempty"`
}

type IRCAuthMechanism

type IRCAuthMechanism string
const (
	IRCAuthMechanismNone      IRCAuthMechanism = "NONE"
	IRCAuthMechanismSASLPlain IRCAuthMechanism = "SASL_PLAIN"
	IRCAuthMechanismNickServ  IRCAuthMechanism = "NICKSERV"
)

type IRCManualProcessRequest added in v1.40.0

type IRCManualProcessRequest struct {
	NetworkId int64  `json:"-"`
	Server    string `json:"server"`
	Channel   string `json:"channel"`
	Nick      string `json:"nick"`
	Message   string `json:"msg"`
}

type IRCParser added in v1.36.0

type IRCParser interface {
	Parse(rls *Release, vars map[string]string) error
}

type IRCParserDefault added in v1.36.0

type IRCParserDefault struct{}

func (IRCParserDefault) Parse added in v1.36.0

func (p IRCParserDefault) Parse(rls *Release, _ map[string]string) error

type IRCParserGazelleGames added in v1.36.0

type IRCParserGazelleGames struct{}

func (IRCParserGazelleGames) Parse added in v1.36.0

func (p IRCParserGazelleGames) Parse(rls *Release, vars map[string]string) error

type IRCParserOrpheus added in v1.36.0

type IRCParserOrpheus struct{}

func (IRCParserOrpheus) Parse added in v1.36.0

func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error

type IRCParserRedacted added in v1.36.0

type IRCParserRedacted struct{}

IRCParserRedacted parser for Redacted announces

func (IRCParserRedacted) Parse added in v1.36.0

func (p IRCParserRedacted) Parse(rls *Release, vars map[string]string) error

type IgnoreSlowTorrentsCondition

type IgnoreSlowTorrentsCondition string
const (
	IgnoreSlowTorrentsModeAlways     IgnoreSlowTorrentsCondition = "ALWAYS"
	IgnoreSlowTorrentsModeMaxReached IgnoreSlowTorrentsCondition = "MAX_DOWNLOADS_REACHED"
)

type Indexer

type Indexer struct {
	ID                 int64             `json:"id"`
	Name               string            `json:"name"`
	Identifier         string            `json:"identifier"`
	IdentifierExternal string            `json:"identifier_external"`
	Enabled            bool              `json:"enabled"`
	Implementation     string            `json:"implementation"`
	BaseURL            string            `json:"base_url,omitempty"`
	UseProxy           bool              `json:"use_proxy"`
	Proxy              *Proxy            `json:"proxy"`
	ProxyID            int64             `json:"proxy_id"`
	Settings           map[string]string `json:"settings,omitempty"`
}

func (Indexer) ImplementationIsFeed added in v1.49.0

func (i Indexer) ImplementationIsFeed() bool

type IndexerDefinition

type IndexerDefinition struct {
	ID                 int               `json:"id,omitempty"`
	Name               string            `json:"name"`
	Identifier         string            `json:"identifier"`
	IdentifierExternal string            `json:"identifier_external"`
	Implementation     string            `json:"implementation"`
	BaseURL            string            `json:"base_url,omitempty"`
	Enabled            bool              `json:"enabled"`
	Description        string            `json:"description"`
	Language           string            `json:"language"`
	Privacy            string            `json:"privacy"`
	Protocol           string            `json:"protocol"`
	URLS               []string          `json:"urls"`
	Supports           []string          `json:"supports"`
	UseProxy           bool              `json:"use_proxy"`
	ProxyID            int64             `json:"proxy_id"`
	Settings           []IndexerSetting  `json:"settings,omitempty"`
	SettingsMap        map[string]string `json:"-"`
	IRC                *IndexerIRC       `json:"irc,omitempty"`
	Torznab            *Torznab          `json:"torznab,omitempty"`
	Newznab            *Newznab          `json:"newznab,omitempty"`
	RSS                *FeedSettings     `json:"rss,omitempty"`
}

func (IndexerDefinition) HasApi

func (i IndexerDefinition) HasApi() bool

type IndexerDefinitionCustom

type IndexerDefinitionCustom struct {
	ID             int               `json:"id,omitempty"`
	Name           string            `json:"name"`
	Identifier     string            `json:"identifier"`
	Implementation string            `json:"implementation"`
	BaseURL        string            `json:"base_url,omitempty"`
	Enabled        bool              `json:"enabled,omitempty"`
	Description    string            `json:"description"`
	Language       string            `json:"language"`
	Privacy        string            `json:"privacy"`
	Protocol       string            `json:"protocol"`
	URLS           []string          `json:"urls"`
	Supports       []string          `json:"supports"`
	Settings       []IndexerSetting  `json:"settings,omitempty"`
	SettingsMap    map[string]string `json:"-"`
	IRC            *IndexerIRC       `json:"irc,omitempty"`
	Torznab        *Torznab          `json:"torznab,omitempty"`
	Newznab        *Newznab          `json:"newznab,omitempty"`
	RSS            *FeedSettings     `json:"rss,omitempty"`
	Parse          *IndexerIRCParse  `json:"parse,omitempty"`
}

func (*IndexerDefinitionCustom) ToIndexerDefinition

func (i *IndexerDefinitionCustom) ToIndexerDefinition() *IndexerDefinition

type IndexerIRC

type IndexerIRC struct {
	Network     string            `json:"network"`
	Server      string            `json:"server"`
	Port        int               `json:"port"`
	TLS         bool              `json:"tls"`
	Channels    []string          `json:"channels"`
	Announcers  []string          `json:"announcers"`
	SettingsMap map[string]string `json:"-"`
	Settings    []IndexerSetting  `json:"settings"`
	Parse       *IndexerIRCParse  `json:"parse,omitempty"`
}

func (IndexerIRC) ValidAnnouncer

func (i IndexerIRC) ValidAnnouncer(announcer string) bool

func (IndexerIRC) ValidChannel

func (i IndexerIRC) ValidChannel(channel string) bool

type IndexerIRCParse

type IndexerIRCParse struct {
	Type          string                `json:"type"`
	ForceSizeUnit string                `json:"forcesizeunit"`
	Lines         []IndexerIRCParseLine `json:"lines"`
	Match         IndexerIRCParseMatch  `json:"match"`
}

func (*IndexerIRCParse) Parse added in v1.36.0

func (p *IndexerIRCParse) Parse(def *IndexerDefinition, vars map[string]string, rls *Release) error

type IndexerIRCParseLine

type IndexerIRCParseLine struct {
	Tests   []LineTest `json:"tests"`
	Pattern string     `json:"pattern"`
	Vars    []string   `json:"vars"`
	Ignore  bool       `json:"ignore"`
}

type IndexerIRCParseMatch

type IndexerIRCParseMatch struct {
	TorrentURL  string   `json:"torrenturl"`
	TorrentName string   `json:"torrentname"`
	InfoURL     string   `json:"infourl"`
	Encode      []string `json:"encode"`
}

func (*IndexerIRCParseMatch) ParseTorrentName added in v1.36.0

func (p *IndexerIRCParseMatch) ParseTorrentName(vars map[string]string, rls *Release) error

func (*IndexerIRCParseMatch) ParseURLs added in v1.36.0

func (p *IndexerIRCParseMatch) ParseURLs(baseURL string, vars map[string]string, rls *Release) error

type IndexerIRCParseMatched

type IndexerIRCParseMatched struct {
	InfoURL     string
	TorrentURL  string
	TorrentName string
}

type IndexerImplementation

type IndexerImplementation string
const (
	IndexerImplementationIRC     IndexerImplementation = "irc"
	IndexerImplementationTorznab IndexerImplementation = "torznab"
	IndexerImplementationNewznab IndexerImplementation = "newznab"
	IndexerImplementationRSS     IndexerImplementation = "rss"
	IndexerImplementationLegacy  IndexerImplementation = ""
)

func (IndexerImplementation) String

func (i IndexerImplementation) String() string

type IndexerMinimal added in v1.41.0

type IndexerMinimal struct {
	ID                 int    `json:"id"`
	Name               string `json:"name"`
	Identifier         string `json:"identifier"`
	IdentifierExternal string `json:"identifier_external"`
}

func (IndexerMinimal) GetExternalIdentifier added in v1.45.0

func (m IndexerMinimal) GetExternalIdentifier() string

type IndexerRepo

type IndexerRepo interface {
	Store(ctx context.Context, indexer Indexer) (*Indexer, error)
	Update(ctx context.Context, indexer Indexer) (*Indexer, error)
	List(ctx context.Context) ([]Indexer, error)
	Delete(ctx context.Context, id int) error
	FindByFilterID(ctx context.Context, id int) ([]Indexer, error)
	FindByID(ctx context.Context, id int) (*Indexer, error)
	GetBy(ctx context.Context, req GetIndexerRequest) (*Indexer, error)
	ToggleEnabled(ctx context.Context, indexerID int, enabled bool) error
}

type IndexerSetting

type IndexerSetting struct {
	Name        string `json:"name"`
	Required    bool   `json:"required,omitempty"`
	Type        string `json:"type"`
	Value       string `json:"value,omitempty"`
	Label       string `json:"label"`
	Default     string `json:"default,omitempty"`
	Description string `json:"description,omitempty"`
	Help        string `json:"help,omitempty"`
	Regex       string `json:"regex,omitempty"`
}

type IndexerTestApiRequest

type IndexerTestApiRequest struct {
	IndexerId  int    `json:"id,omitempty"`
	Identifier string `json:"identifier,omitempty"`
	ApiUser    string `json:"api_user,omitempty"`
	ApiKey     string `json:"api_key"`
}

type IrcChannel

type IrcChannel struct {
	ID         int64  `json:"id"`
	Enabled    bool   `json:"enabled"`
	Name       string `json:"name"`
	Password   string `json:"password"`
	Detached   bool   `json:"detached"`
	Monitoring bool   `json:"monitoring"`
}

type IrcMessage added in v1.27.0

type IrcMessage struct {
	Channel string    `json:"channel"`
	Nick    string    `json:"nick"`
	Message string    `json:"msg"`
	Time    time.Time `json:"time"`
}

func (IrcMessage) Bytes added in v1.27.0

func (m IrcMessage) Bytes() []byte

func (IrcMessage) ToJsonString added in v1.27.0

func (m IrcMessage) ToJsonString() string

type IrcNetwork

type IrcNetwork struct {
	ID             int64        `json:"id"`
	Name           string       `json:"name"`
	Enabled        bool         `json:"enabled"`
	Server         string       `json:"server"`
	Port           int          `json:"port"`
	TLS            bool         `json:"tls"`
	Pass           string       `json:"pass"`
	Nick           string       `json:"nick"`
	Auth           IRCAuth      `json:"auth,omitempty"`
	InviteCommand  string       `json:"invite_command"`
	UseBouncer     bool         `json:"use_bouncer"`
	BouncerAddr    string       `json:"bouncer_addr"`
	UseProxy       bool         `json:"use_proxy"`
	ProxyId        int64        `json:"proxy_id"`
	Proxy          *Proxy       `json:"proxy"`
	BotMode        bool         `json:"bot_mode"`
	Channels       []IrcChannel `json:"channels"`
	Connected      bool         `json:"connected"`
	ConnectedSince *time.Time   `json:"connected_since"`
}

type IrcNetworkWithHealth

type IrcNetworkWithHealth struct {
	ID               int64               `json:"id"`
	Name             string              `json:"name"`
	Enabled          bool                `json:"enabled"`
	Server           string              `json:"server"`
	Port             int                 `json:"port"`
	TLS              bool                `json:"tls"`
	Pass             string              `json:"pass"`
	Nick             string              `json:"nick"`
	Auth             IRCAuth             `json:"auth,omitempty"`
	InviteCommand    string              `json:"invite_command"`
	UseBouncer       bool                `json:"use_bouncer"`
	BouncerAddr      string              `json:"bouncer_addr"`
	BotMode          bool                `json:"bot_mode"`
	CurrentNick      string              `json:"current_nick"`
	PreferredNick    string              `json:"preferred_nick"`
	UseProxy         bool                `json:"use_proxy"`
	ProxyId          int64               `json:"proxy_id"`
	Proxy            *Proxy              `json:"proxy"`
	Channels         []ChannelWithHealth `json:"channels"`
	Connected        bool                `json:"connected"`
	ConnectedSince   time.Time           `json:"connected_since"`
	ConnectionErrors []string            `json:"connection_errors"`
	Healthy          bool                `json:"healthy"`
}

type IrcRepo

type IrcRepo interface {
	StoreNetwork(ctx context.Context, network *IrcNetwork) error
	UpdateNetwork(ctx context.Context, network *IrcNetwork) error
	StoreChannel(ctx context.Context, networkID int64, channel *IrcChannel) error
	UpdateChannel(channel *IrcChannel) error
	UpdateInviteCommand(networkID int64, invite string) error
	StoreNetworkChannels(ctx context.Context, networkID int64, channels []IrcChannel) error
	CheckExistingNetwork(ctx context.Context, network *IrcNetwork) (*IrcNetwork, error)
	FindActiveNetworks(ctx context.Context) ([]IrcNetwork, error)
	ListNetworks(ctx context.Context) ([]IrcNetwork, error)
	ListChannels(networkID int64) ([]IrcChannel, error)
	GetNetworkByID(ctx context.Context, id int64) (*IrcNetwork, error)
	DeleteNetwork(ctx context.Context, id int64) error
}

type LineTest added in v1.34.0

type LineTest struct {
	Line   string            `json:"line"`
	Expect map[string]string `json:"expect"`
}

type Macro

type Macro struct {
	Artists                   string
	Audio                     []string
	AudioChannels             string
	AudioFormat               string
	Bitrate                   string
	Bonus                     []string
	Categories                []string
	Category                  string
	Codec                     []string
	Container                 string
	CurrentDay                int
	CurrentHour               int
	CurrentMinute             int
	CurrentMonth              int
	CurrentSecond             int
	CurrentYear               int
	DownloadUrl               string
	Episode                   int
	FilterID                  int
	FilterName                string
	Freeleech                 bool
	FreeleechPercent          int
	Group                     string
	GroupID                   string
	HDR                       string
	HasCue                    bool
	HasLog                    bool
	Implementation            string
	Indexer                   string
	IndexerIdentifier         string
	IndexerIdentifierExternal string
	IndexerName               string
	InfoUrl                   string
	Language                  []string
	Leechers                  int
	LogScore                  int
	MagnetURI                 string
	Origin                    string
	Other                     []string
	PreTime                   string
	Protocol                  string
	Proper                    bool
	Region                    string
	Repack                    bool
	Resolution                string
	Season                    int
	Seeders                   int
	Size                      uint64
	SizeString                string
	Source                    string
	Tags                      string
	Title                     string
	TorrentDataRawBytes       []byte
	TorrentHash               string
	TorrentID                 string
	TorrentName               string
	TorrentPathName           string
	TorrentUrl                string
	TorrentTmpFile            string
	Type                      string
	Uploader                  string
	Website                   string
	Year                      int
	Month                     int
	Day                       int
}

func NewMacro

func NewMacro(release Release) Macro

func (Macro) MustParse

func (m Macro) MustParse(text string) string

MustParse takes a string and replaces valid vars

func (Macro) Parse

func (m Macro) Parse(text string) (string, error)

Parse takes a string and replaces valid vars

type Newznab

type Newznab struct {
	MinInterval int              `json:"minInterval"`
	Settings    []IndexerSetting `json:"settings"`
}

type Notification

type Notification struct {
	ID        int              `json:"id"`
	Name      string           `json:"name"`
	Type      NotificationType `json:"type"`
	Enabled   bool             `json:"enabled"`
	Events    []string         `json:"events"`
	Token     string           `json:"token"`
	APIKey    string           `json:"api_key"`
	Webhook   string           `json:"webhook"`
	Title     string           `json:"title"`
	Icon      string           `json:"icon"`
	Username  string           `json:"username"`
	Host      string           `json:"host"`
	Password  string           `json:"password"`
	Channel   string           `json:"channel"`
	Rooms     string           `json:"rooms"`
	Targets   string           `json:"targets"`
	Devices   string           `json:"devices"`
	Priority  int32            `json:"priority"`
	Topic     string           `json:"topic"`
	CreatedAt time.Time        `json:"created_at"`
	UpdatedAt time.Time        `json:"updated_at"`
}

type NotificationEvent

type NotificationEvent string
const (
	NotificationEventAppUpdateAvailable NotificationEvent = "APP_UPDATE_AVAILABLE"
	NotificationEventPushApproved       NotificationEvent = "PUSH_APPROVED"
	NotificationEventPushRejected       NotificationEvent = "PUSH_REJECTED"
	NotificationEventPushError          NotificationEvent = "PUSH_ERROR"
	NotificationEventIRCDisconnected    NotificationEvent = "IRC_DISCONNECTED"
	NotificationEventIRCReconnected     NotificationEvent = "IRC_RECONNECTED"
	NotificationEventTest               NotificationEvent = "TEST"
)

type NotificationEventArr

type NotificationEventArr []NotificationEvent

type NotificationPayload

type NotificationPayload struct {
	Subject        string
	Message        string
	Event          NotificationEvent
	ReleaseName    string
	Filter         string
	Indexer        string
	InfoHash       string
	Size           uint64
	Status         ReleasePushStatus
	Action         string
	ActionType     ActionType
	ActionClient   string
	Rejections     []string
	Protocol       ReleaseProtocol       // torrent, usenet
	Implementation ReleaseImplementation // irc, rss, api
	Timestamp      time.Time
	Sender         string
}

type NotificationQueryParams

type NotificationQueryParams struct {
	Limit   uint64
	Offset  uint64
	Sort    map[string]string
	Filters struct {
		Indexers   []string
		PushStatus string
	}
	Search string
}

type NotificationRepo

type NotificationRepo interface {
	List(ctx context.Context) ([]Notification, error)
	Find(ctx context.Context, params NotificationQueryParams) ([]Notification, int, error)
	FindByID(ctx context.Context, id int) (*Notification, error)
	Store(ctx context.Context, notification *Notification) error
	Update(ctx context.Context, notification *Notification) error
	Delete(ctx context.Context, notificationID int) error
}

type NotificationSender

type NotificationSender interface {
	Send(event NotificationEvent, payload NotificationPayload) error
	CanSend(event NotificationEvent) bool
	Name() string
}

type NotificationType

type NotificationType string
const (
	NotificationTypeDiscord    NotificationType = "DISCORD"
	NotificationTypeNotifiarr  NotificationType = "NOTIFIARR"
	NotificationTypeIFTTT      NotificationType = "IFTTT"
	NotificationTypeJoin       NotificationType = "JOIN"
	NotificationTypeMattermost NotificationType = "MATTERMOST"
	NotificationTypeMatrix     NotificationType = "MATRIX"
	NotificationTypePushBullet NotificationType = "PUSH_BULLET"
	NotificationTypePushover   NotificationType = "PUSHOVER"
	NotificationTypeRocketChat NotificationType = "ROCKETCHAT"
	NotificationTypeSlack      NotificationType = "SLACK"
	NotificationTypeTelegram   NotificationType = "TELEGRAM"
	NotificationTypeGotify     NotificationType = "GOTIFY"
	NotificationTypeNtfy       NotificationType = "NTFY"
	NotificationTypeLunaSea    NotificationType = "LUNASEA"
	NotificationTypeShoutrrr   NotificationType = "SHOUTRRR"
)

type PriorityLayout added in v1.35.0

type PriorityLayout string
const (
	PriorityLayoutMax     PriorityLayout = "MAX"
	PriorityLayoutMin     PriorityLayout = "MIN"
	PriorityLayoutDefault PriorityLayout = ""
)

type Proxy added in v1.46.0

type Proxy struct {
	ID      int64     `json:"id"`
	Name    string    `json:"name"`
	Enabled bool      `json:"enabled"`
	Type    ProxyType `json:"type"`
	Addr    string    `json:"addr"`
	User    string    `json:"user"`
	Pass    string    `json:"pass"`
	Timeout int       `json:"timeout"`
}

func (Proxy) ValidProxyType added in v1.46.0

func (p Proxy) ValidProxyType() bool

func (Proxy) Validate added in v1.46.0

func (p Proxy) Validate() error

type ProxyRepo added in v1.46.0

type ProxyRepo interface {
	Store(ctx context.Context, p *Proxy) error
	Update(ctx context.Context, p *Proxy) error
	List(ctx context.Context) ([]Proxy, error)
	Delete(ctx context.Context, id int64) error
	FindByID(ctx context.Context, id int64) (*Proxy, error)
	ToggleEnabled(ctx context.Context, id int64, enabled bool) error
}

type ProxyType added in v1.46.0

type ProxyType string

type Rejection added in v1.48.0

type Rejection struct {
	// contains filtered or unexported fields
}

type RejectionReasons added in v1.48.0

type RejectionReasons struct {
	// contains filtered or unexported fields
}

func NewRejectionReasons added in v1.48.0

func NewRejectionReasons() *RejectionReasons

func (*RejectionReasons) Add added in v1.48.0

func (r *RejectionReasons) Add(key string, got any, want any)

func (*RejectionReasons) AddTruncated added in v1.48.0

func (r *RejectionReasons) AddTruncated(key string, got any, want any)

func (*RejectionReasons) Addf added in v1.48.0

func (r *RejectionReasons) Addf(key string, format string, got any, want any)

func (*RejectionReasons) Clear added in v1.48.0

func (r *RejectionReasons) Clear()

Clear rejections

func (*RejectionReasons) Len added in v1.48.0

func (r *RejectionReasons) Len() int

func (*RejectionReasons) String added in v1.48.0

func (r *RejectionReasons) String() string

func (*RejectionReasons) StringTruncated added in v1.48.0

func (r *RejectionReasons) StringTruncated() string

func (*RejectionReasons) WriteJSON added in v1.48.0

func (r *RejectionReasons) WriteJSON() ([]byte, error)

func (*RejectionReasons) WriteString added in v1.48.0

func (r *RejectionReasons) WriteString() string

type Release

type Release struct {
	ID                          int64                 `json:"id"`
	FilterStatus                ReleaseFilterStatus   `json:"filter_status"`
	Rejections                  []string              `json:"rejections"`
	Indexer                     IndexerMinimal        `json:"indexer"`
	FilterName                  string                `json:"filter"`
	Protocol                    ReleaseProtocol       `json:"protocol"`
	Implementation              ReleaseImplementation `json:"implementation"` // irc, rss, api
	Timestamp                   time.Time             `json:"timestamp"`
	InfoURL                     string                `json:"info_url"`
	DownloadURL                 string                `json:"download_url"`
	MagnetURI                   string                `json:"-"`
	GroupID                     string                `json:"group_id"`
	TorrentID                   string                `json:"torrent_id"`
	TorrentTmpFile              string                `json:"-"`
	TorrentDataRawBytes         []byte                `json:"-"`
	TorrentHash                 string                `json:"-"`
	TorrentName                 string                `json:"name"` // full release name
	Size                        uint64                `json:"size"`
	Title                       string                `json:"title"` // Parsed title
	Description                 string                `json:"-"`
	Category                    string                `json:"category"`
	Categories                  []string              `json:"categories,omitempty"`
	Season                      int                   `json:"season"`
	Episode                     int                   `json:"episode"`
	Year                        int                   `json:"year"`
	Month                       int                   `json:"month"`
	Day                         int                   `json:"day"`
	Resolution                  string                `json:"resolution"`
	Source                      string                `json:"source"`
	Codec                       []string              `json:"codec"`
	Container                   string                `json:"container"`
	HDR                         []string              `json:"hdr"`
	Audio                       []string              `json:"-"`
	AudioChannels               string                `json:"-"`
	AudioFormat                 string                `json:"-"`
	Bitrate                     string                `json:"-"`
	Group                       string                `json:"group"`
	Region                      string                `json:"-"`
	Language                    []string              `json:"-"`
	Proper                      bool                  `json:"proper"`
	Repack                      bool                  `json:"repack"`
	Website                     string                `json:"website"`
	Artists                     string                `json:"-"`
	Type                        string                `json:"type"` // Album,Single,EP
	LogScore                    int                   `json:"-"`
	HasCue                      bool                  `json:"-"`
	HasLog                      bool                  `json:"-"`
	Origin                      string                `json:"origin"` // P2P, Internal
	Tags                        []string              `json:"-"`
	ReleaseTags                 string                `json:"-"`
	Freeleech                   bool                  `json:"-"`
	FreeleechPercent            int                   `json:"-"`
	Bonus                       []string              `json:"-"`
	Uploader                    string                `json:"uploader"`
	PreTime                     string                `json:"pre_time"`
	Other                       []string              `json:"-"`
	RawCookie                   string                `json:"-"`
	Seeders                     int                   `json:"-"`
	Leechers                    int                   `json:"-"`
	AdditionalSizeCheckRequired bool                  `json:"-"`
	FilterID                    int                   `json:"-"`
	Filter                      *Filter               `json:"-"`
	ActionStatus                []ReleaseActionStatus `json:"action_status"`
}

func NewRelease

func NewRelease(indexer IndexerMinimal) *Release

func (*Release) CleanupTemporaryFiles

func (r *Release) CleanupTemporaryFiles()

func (*Release) DownloadTorrentFileCtx

func (r *Release) DownloadTorrentFileCtx(ctx context.Context) error

func (*Release) HasMagnetUri

func (r *Release) HasMagnetUri() bool

HasMagnetUri check uf MagnetURI is set and valid or empty

func (*Release) MapVars

func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) error

MapVars map vars from regex captures to fields on release

func (*Release) OpenTorrentFile added in v1.46.0

func (r *Release) OpenTorrentFile() error

func (*Release) ParseReleaseTagsString

func (r *Release) ParseReleaseTagsString(tags string)

func (*Release) ParseSizeBytesString

func (r *Release) ParseSizeBytesString(size string)

ParseSizeBytesString If there are parsing errors, then it keeps the original (or default size 0) Otherwise, it will update the size only if the new size is bigger than the previous one.

func (*Release) ParseString

func (r *Release) ParseString(title string)

func (*Release) Raw added in v1.37.0

func (r *Release) Raw(s string) rls.Release

type ReleaseActionRetryReq added in v1.26.0

type ReleaseActionRetryReq struct {
	ReleaseId      int
	ActionStatusId int
	ActionId       int
}

type ReleaseActionStatus

type ReleaseActionStatus struct {
	ID         int64             `json:"id"`
	Status     ReleasePushStatus `json:"status"`
	Action     string            `json:"action"`
	ActionID   int64             `json:"action_id"`
	Type       ActionType        `json:"type"`
	Client     string            `json:"client"`
	Filter     string            `json:"filter"`
	FilterID   int64             `json:"filter_id"`
	Rejections []string          `json:"rejections"`
	ReleaseID  int64             `json:"release_id"`
	Timestamp  time.Time         `json:"timestamp"`
}

func NewReleaseActionStatus

func NewReleaseActionStatus(action *Action, release *Release) *ReleaseActionStatus

type ReleaseFilterStatus

type ReleaseFilterStatus string
const (
	ReleaseStatusFilterApproved ReleaseFilterStatus = "FILTER_APPROVED"
	ReleaseStatusFilterPending  ReleaseFilterStatus = "PENDING"
)

type ReleaseImplementation

type ReleaseImplementation string
const (
	ReleaseImplementationIRC     ReleaseImplementation = "IRC"
	ReleaseImplementationTorznab ReleaseImplementation = "TORZNAB"
	ReleaseImplementationNewznab ReleaseImplementation = "NEWZNAB"
	ReleaseImplementationRSS     ReleaseImplementation = "RSS"
)

func (ReleaseImplementation) String

func (r ReleaseImplementation) String() string

type ReleaseProcessReq added in v1.40.0

type ReleaseProcessReq struct {
	IndexerIdentifier     string   `json:"indexer_identifier"`
	IndexerImplementation string   `json:"indexer_implementation"`
	AnnounceLines         []string `json:"announce_lines"`
}

type ReleaseProtocol

type ReleaseProtocol string
const (
	ReleaseProtocolTorrent ReleaseProtocol = "torrent"
	ReleaseProtocolNzb     ReleaseProtocol = "usenet"
)

func (ReleaseProtocol) String

func (r ReleaseProtocol) String() string

type ReleasePushStatus

type ReleasePushStatus string
const (
	ReleasePushStatusPending  ReleasePushStatus = "PENDING" // Initial status
	ReleasePushStatusApproved ReleasePushStatus = "PUSH_APPROVED"
	ReleasePushStatusRejected ReleasePushStatus = "PUSH_REJECTED"
	ReleasePushStatusErr      ReleasePushStatus = "PUSH_ERROR"
)

func (ReleasePushStatus) String

func (r ReleasePushStatus) String() string

type ReleaseQueryParams

type ReleaseQueryParams struct {
	Limit   uint64
	Offset  uint64
	Cursor  uint64
	Sort    map[string]string
	Filters struct {
		Indexers   []string
		PushStatus string
	}
	Search string
}

type ReleaseRepo

type ReleaseRepo interface {
	Store(ctx context.Context, release *Release) error
	Update(ctx context.Context, r *Release) error
	Find(ctx context.Context, params ReleaseQueryParams) (*FindReleasesResponse, error)
	Get(ctx context.Context, req *GetReleaseRequest) (*Release, error)
	GetIndexerOptions(ctx context.Context) ([]string, error)
	Stats(ctx context.Context) (*ReleaseStats, error)
	Delete(ctx context.Context, req *DeleteReleaseRequest) error
	CheckSmartEpisodeCanDownload(ctx context.Context, p *SmartEpisodeParams) (bool, error)
	UpdateBaseURL(ctx context.Context, indexer string, oldBaseURL, newBaseURL string) error

	GetActionStatus(ctx context.Context, req *GetReleaseActionStatusRequest) (*ReleaseActionStatus, error)
	StoreReleaseActionStatus(ctx context.Context, status *ReleaseActionStatus) error
}

type ReleaseStats

type ReleaseStats struct {
	TotalCount          int64 `json:"total_count"`
	FilteredCount       int64 `json:"filtered_count"`
	FilterRejectedCount int64 `json:"filter_rejected_count"`
	PushApprovedCount   int64 `json:"push_approved_count"`
	PushRejectedCount   int64 `json:"push_rejected_count"`
	PushErrorCount      int64 `json:"push_error_count"`
}

type ReleaseTags

type ReleaseTags struct {
	Audio        []string
	AudioBitrate string
	AudioFormat  string
	LogScore     int
	HasLog       bool
	HasCue       bool
	Bonus        []string
	Channels     string
	Codec        string
	Container    string
	HDR          []string
	Origin       string
	Other        []string
	Resolution   string
	Source       string
}

func ParseReleaseTagString

func ParseReleaseTagString(tags string) ReleaseTags

func ParseReleaseTags

func ParseReleaseTags(tags []string) ReleaseTags

type SendIrcCmdRequest added in v1.27.0

type SendIrcCmdRequest struct {
	NetworkId int64  `json:"network_id"`
	Server    string `json:"server"`
	Channel   string `json:"channel"`
	Nick      string `json:"nick"`
	Message   string `json:"msg"`
}

type SmartEpisodeParams added in v1.43.0

type SmartEpisodeParams struct {
	Title   string
	Season  int
	Episode int
	Year    int
	Month   int
	Day     int
	Repack  bool
	Proper  bool
	Group   string
}

func (*SmartEpisodeParams) IsDailyEpisode added in v1.43.0

func (p *SmartEpisodeParams) IsDailyEpisode() bool

type TagInfo

type TagInfo struct {
	// contains filtered or unexported fields
}

func (*TagInfo) FindMatch added in v1.36.0

func (info *TagInfo) FindMatch(t string) []string

FindMatch returns the regexp matches.

func (*TagInfo) Match

func (info *TagInfo) Match(s string) bool

Match matches the tag info to s.

func (*TagInfo) RE

func (info *TagInfo) RE() string

RE returns the tag info regexp string.

func (*TagInfo) Regexp

func (info *TagInfo) Regexp() string

Regexp returns the tag info regexp.

func (*TagInfo) Tag

func (info *TagInfo) Tag() string

Tag returns the tag info tag.

func (*TagInfo) Title

func (info *TagInfo) Title() string

Title returns the tag info title.

type TorrentBasic

type TorrentBasic struct {
	Id        string `json:"Id"`
	TorrentId string `json:"TorrentId,omitempty"`
	InfoHash  string `json:"InfoHash"`
	Size      string `json:"Size"`
	Uploader  string `json:"Uploader"`
}

func (TorrentBasic) ReleaseSizeBytes

func (t TorrentBasic) ReleaseSizeBytes() uint64

type Torznab

type Torznab struct {
	MinInterval int              `json:"minInterval"`
	Settings    []IndexerSetting `json:"settings"`
}

type UpdateUserRequest added in v1.35.0

type UpdateUserRequest struct {
	UsernameCurrent string `json:"username_username"`
	UsernameNew     string `json:"username_new"`
	PasswordCurrent string `json:"password_current"`
	PasswordNew     string `json:"password_new"`
	PasswordNewHash string `json:"-"`
}

type User

type User struct {
	ID       int    `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserRepo

type UserRepo interface {
	GetUserCount(ctx context.Context) (int, error)
	FindByUsername(ctx context.Context, username string) (*User, error)
	Store(ctx context.Context, req CreateUserRequest) error
	Update(ctx context.Context, req UpdateUserRequest) error
	Delete(ctx context.Context, username string) error
}

Jump to

Keyboard shortcuts

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