integration

package
v0.0.0-...-d25a9c8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-3.0, GPL-3.0-only Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPath

func CheckPath(path string) error

CheckPath checks a path string and if it is a directory, it attempts to create a test file in the directory. If it is a file, it checks that the file exists. Returns a non-nil error if an error is encountered

func FilterReleases

func FilterReleases(releases []Release, filter string, runtime *int64) ([]Release, []Release, error)

FilterReleases takes a pointer to a slice of Releases, as well as a CSL script that is expected to always return a boolean. The CSL script will be run once for each release, and will have the `a` variable set to the CSL list representation of the given release. The CSL script should either true or false, OR it can return a string/list of strings that will be treated the same as a return false. The string(s) will be displayed as errors to the user for why the release failed the filter. True means to include the release, false means to filter it out. Returns a slice of all included and excluded releases, as well as a non-nil error if the CSL script fails to execute properly.

If this function ends due to an error, no guarantees are made for the returned release slices.

func MkdirTemp

func MkdirTemp(pattern string) (string, error)

func SortReleases

func SortReleases(releases *[]Release, sorter string, runtime *int64) error

SortReleases takes a pointer to a slice of Releases, as well as a CSL script whose job is to return true if release A should be preferred over release B, and false otherwise. The CSL script will be run with the `a` and `b` variables set to the CSL list representation of the pair of releases. The CSL script should always return either true or false. True means release A > release B.

If this function ends due to an error, correctness is not guaranteed, and the releases slice may be corrupt. If data should not be modified in the event of an error, it is recommended to make a copy of your releases slice before calling SortReleases

func TempDir

func TempDir() (string, error)

Types

type Directory

type Directory struct {
	Text       string `xml:",chardata"`
	AllowSync  string `xml:"allowSync,attr"`
	Art        string `xml:"art,attr"`
	Filters    string `xml:"filters,attr"`
	Refreshing string `xml:"refreshing,attr"`
	Thumb      string `xml:"thumb,attr"`
	RatingKey  string `xml:"ratingKey,attr"`
	Key        string `xml:"key,attr"`
	Type       string `xml:"type,attr"`
	Title      string `xml:"title,attr"`
	Agent      string `xml:"agent,attr"`
	Scanner    string `xml:"scanner,attr"`
	Language   string `xml:"language,attr"`
	Uuid       string `xml:"uuid,attr"`
	UpdatedAt  string `xml:"updatedAt,attr"`
	CreatedAt  string `xml:"createdAt,attr"`
	Locations  []struct {
		Text string `xml:",chardata"`
		ID   string `xml:"id,attr"`
		Path string `xml:"path,attr"`
	} `xml:"Location"`
}

type Download

type Download struct {
	ID           int
	MediaID      int
	FriendlyName string
	Identifier   string
	FinalDir     string
	// Status of the media
	Status string
	// Started time
	Started time.Time
	// BytesLeft number of bytes remaining to download
	BytesLeft uint64
	// FullSize full size of the download in bytes
	FullSize uint64
}

type Downloader

type Downloader interface {
	// AddRelease takes a Release struct and adds it to the downloader, returning a string
	// identifier that can later be used in the argument passed to PollDownloads to specify
	// which downloads to poll for. Returns non-nil error on failure.
	AddRelease(Release) (string, error)

	// DeleteDownload takes a string download identifier and deletes it from the downloader.
	// Returns non-nil error on failure.
	DeleteDownload(string) error

	// PollDownloads takes a string of download identifiers which were returned by earlier calls
	// to AddRelease, and performs a refresh for the status of all the downloads identified in the
	// string array. Returns the updated downloads and any error.
	PollDownloads([]string) ([]Download, error)

	// TestConnection checks the connection to the downloader, and returns a non-nil error on failure.
	TestConnection() error
}

func NewDownloaderFromConfig

func NewDownloaderFromConfig(downloaderType string, config map[string]interface{}) (Downloader, error)

type Indexer

type Indexer interface {
	SearchEpisode(seasonNum, episodeNum int, showTitle string, tvdbID *int, imdbID *string) ([]Release, error)
	SearchSeason(seasonNum int, showTitle string, tvdbID *int, imdbID *string) ([]Release, error)
	SearchMovie(movieTitle string, year int, imdbID *string) ([]Release, error)
	SyncRSS(lastRSSID string) ([]Release, error)
	TestConnection() error
}

type ItemEntry

type ItemEntry struct {
	NZBID              int
	NZBFilename        string
	NZBName            string
	Kind               string
	URL                string
	DestDir            string
	FinalDir           string
	Category           string
	FileSizeLo         uint
	FileSizeHi         uint
	FileSizeMB         int
	RemainingSizeLo    uint
	RemainingSizeHi    uint
	RemainingSizeMB    int
	PausedSizeLo       uint
	PausedSizeHi       uint
	PausedSizeMB       int
	FileCount          int
	RemainingFileCount int
	RemainingParCount  int
	MinPostTime        int
	MaxPostTime        int
	MaxPriority        int
	ActiveDownloads    int
	Status             string
	TotalArticles      int
	SuccessArticles    int
	FailedArticles     int
	Health             int
	CriticalHealth     int
	DownloadedSizeLo   uint
	DownlaodedSizeHi   uint
	DownloadedSizeMB   int
	DownloadTimeSec    int
	MessageCount       int
	DupeKey            string
	DupeScore          int
	DupeMode           string
	Parameters         []struct {
		Name  string
		Value string
	}
	ParStatus        string
	UnpackStatus     string
	MoveStatus       string
	DeleteStatus     string
	MarkStatus       string
	PostTotalTimeSec int
	ParTimeSec       int
	RepairTimeSec    int
	UnpackTimeSec    int
	PostInfoText     string
}

type Jellyfin

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

func NewJellyfin

func NewJellyfin(apiKey, baseUrl string) *Jellyfin

func NewJellyfinFromConfig

func NewJellyfinFromConfig(configuration map[string]interface{}) (*Jellyfin, error)

func (*Jellyfin) GetMediaPaths

func (j *Jellyfin) GetMediaPaths() ([]MediaPath, error)

func (*Jellyfin) ImportMedia

func (j *Jellyfin) ImportMedia(mediaPath string) error

func (*Jellyfin) TestConnection

func (j *Jellyfin) TestConnection() error

type JellyfinItemsResponse

type JellyfinItemsResponse struct {
	Items []struct {
		Name              string      `json:"Name"`
		ServerID          string      `json:"ServerId"`
		ID                string      `json:"Id"`
		HasSubtitles      bool        `json:"HasSubtitles,omitempty"`
		Container         string      `json:"Container"`
		PremiereDate      time.Time   `json:"PremiereDate"`
		Path              string      `json:"Path"`
		OfficialRating    string      `json:"OfficialRating,omitempty"`
		ChannelID         interface{} `json:"ChannelId"`
		CommunityRating   float64     `json:"CommunityRating,omitempty"`
		RunTimeTicks      int64       `json:"RunTimeTicks"`
		ProductionYear    int         `json:"ProductionYear"`
		IndexNumber       int         `json:"IndexNumber"`
		ParentIndexNumber int         `json:"ParentIndexNumber"`
		IsFolder          bool        `json:"IsFolder"`
		Type              string      `json:"Type"`
		UserData          struct {
			PlaybackPositionTicks int    `json:"PlaybackPositionTicks"`
			PlayCount             int    `json:"PlayCount"`
			IsFavorite            bool   `json:"IsFavorite"`
			Played                bool   `json:"Played"`
			Key                   string `json:"Key"`
		} `json:"UserData"`
		SeriesName            string `json:"SeriesName"`
		SeriesID              string `json:"SeriesId"`
		SeasonID              string `json:"SeasonId"`
		SeriesPrimaryImageTag string `json:"SeriesPrimaryImageTag"`
		SeasonName            string `json:"SeasonName"`
		VideoType             string `json:"VideoType"`
		ImageTags             struct {
			Primary string `json:"Primary"`
		} `json:"ImageTags"`
		BackdropImageTags       []interface{} `json:"BackdropImageTags"`
		LocationType            string        `json:"LocationType"`
		MediaType               string        `json:"MediaType"`
		ParentBackdropItemID    string        `json:"ParentBackdropItemId,omitempty"`
		ParentBackdropImageTags []string      `json:"ParentBackdropImageTags,omitempty"`
	} `json:"Items"`
}

type JellyfinUsers

type JellyfinUsers []struct {
	Name                      string    `json:"Name"`
	ServerID                  string    `json:"ServerId"`
	ID                        string    `json:"Id"`
	HasPassword               bool      `json:"HasPassword"`
	HasConfiguredPassword     bool      `json:"HasConfiguredPassword"`
	HasConfiguredEasyPassword bool      `json:"HasConfiguredEasyPassword"`
	EnableAutoLogin           bool      `json:"EnableAutoLogin"`
	LastLoginDate             time.Time `json:"LastLoginDate"`
	LastActivityDate          time.Time `json:"LastActivityDate"`
	Configuration             struct {
		PlayDefaultAudioTrack      bool          `json:"PlayDefaultAudioTrack"`
		SubtitleLanguagePreference string        `json:"SubtitleLanguagePreference"`
		DisplayMissingEpisodes     bool          `json:"DisplayMissingEpisodes"`
		GroupedFolders             []interface{} `json:"GroupedFolders"`
		SubtitleMode               string        `json:"SubtitleMode"`
		DisplayCollectionsView     bool          `json:"DisplayCollectionsView"`
		EnableLocalPassword        bool          `json:"EnableLocalPassword"`
		OrderedViews               []interface{} `json:"OrderedViews"`
		LatestItemsExcludes        []interface{} `json:"LatestItemsExcludes"`
		MyMediaExcludes            []interface{} `json:"MyMediaExcludes"`
		HidePlayedInLatest         bool          `json:"HidePlayedInLatest"`
		RememberAudioSelections    bool          `json:"RememberAudioSelections"`
		RememberSubtitleSelections bool          `json:"RememberSubtitleSelections"`
		EnableNextEpisodeAutoPlay  bool          `json:"EnableNextEpisodeAutoPlay"`
	} `json:"Configuration"`
	Policy struct {
		IsAdministrator                  bool          `json:"IsAdministrator"`
		IsHidden                         bool          `json:"IsHidden"`
		IsDisabled                       bool          `json:"IsDisabled"`
		BlockedTags                      []interface{} `json:"BlockedTags"`
		EnableUserPreferenceAccess       bool          `json:"EnableUserPreferenceAccess"`
		AccessSchedules                  []interface{} `json:"AccessSchedules"`
		BlockUnratedItems                []interface{} `json:"BlockUnratedItems"`
		EnableRemoteControlOfOtherUsers  bool          `json:"EnableRemoteControlOfOtherUsers"`
		EnableSharedDeviceControl        bool          `json:"EnableSharedDeviceControl"`
		EnableRemoteAccess               bool          `json:"EnableRemoteAccess"`
		EnableLiveTvManagement           bool          `json:"EnableLiveTvManagement"`
		EnableLiveTvAccess               bool          `json:"EnableLiveTvAccess"`
		EnableMediaPlayback              bool          `json:"EnableMediaPlayback"`
		EnableAudioPlaybackTranscoding   bool          `json:"EnableAudioPlaybackTranscoding"`
		EnableVideoPlaybackTranscoding   bool          `json:"EnableVideoPlaybackTranscoding"`
		EnablePlaybackRemuxing           bool          `json:"EnablePlaybackRemuxing"`
		ForceRemoteSourceTranscoding     bool          `json:"ForceRemoteSourceTranscoding"`
		EnableContentDeletion            bool          `json:"EnableContentDeletion"`
		EnableContentDeletionFromFolders []interface{} `json:"EnableContentDeletionFromFolders"`
		EnableContentDownloading         bool          `json:"EnableContentDownloading"`
		EnableSyncTranscoding            bool          `json:"EnableSyncTranscoding"`
		EnableMediaConversion            bool          `json:"EnableMediaConversion"`
		EnabledDevices                   []interface{} `json:"EnabledDevices"`
		EnableAllDevices                 bool          `json:"EnableAllDevices"`
		EnabledChannels                  []interface{} `json:"EnabledChannels"`
		EnableAllChannels                bool          `json:"EnableAllChannels"`
		EnabledFolders                   []interface{} `json:"EnabledFolders"`
		EnableAllFolders                 bool          `json:"EnableAllFolders"`
		InvalidLoginAttemptCount         int           `json:"InvalidLoginAttemptCount"`
		LoginAttemptsBeforeLockout       int           `json:"LoginAttemptsBeforeLockout"`
		MaxActiveSessions                int           `json:"MaxActiveSessions"`
		EnablePublicSharing              bool          `json:"EnablePublicSharing"`
		BlockedMediaFolders              []interface{} `json:"BlockedMediaFolders"`
		BlockedChannels                  []interface{} `json:"BlockedChannels"`
		RemoteClientBitrateLimit         int           `json:"RemoteClientBitrateLimit"`
		AuthenticationProviderID         string        `json:"AuthenticationProviderId"`
		PasswordResetProviderID          string        `json:"PasswordResetProviderId"`
		SyncPlayAccess                   string        `json:"SyncPlayAccess"`
	} `json:"Policy"`
}

type MediaContainer

type MediaContainer struct {
	XMLName         xml.Name    `xml:"MediaContainer"`
	Text            string      `xml:",chardata"`
	Size            string      `xml:"size,attr"`
	AllowSync       string      `xml:"allowSync,attr"`
	Identifier      string      `xml:"identifier,attr"`
	MediaTagPrefix  string      `xml:"mediaTagPrefix,attr"`
	MediaTagVersion string      `xml:"mediaTagVersion,attr"`
	Title1          string      `xml:"title1,attr"`
	Directories     []Directory `xml:"Directory"`
	Videos          []Video     `xml:"Video"`
}

type MediaPath

type MediaPath struct {
	Title            string
	ParentTitle      string
	GrandparentTitle string
	Path             string
}

type MediaServer

type MediaServer interface {
	/*
		ImportMedia imports media from a filepath into the media server
	*/
	ImportMedia(string) error
	/*
		TestConnection returns a non-nil error if the media server fails to connect
	*/
	TestConnection() error
	/*
		GetMediaPaths returns a slice of all media paths available on the server
	*/
	GetMediaPaths() ([]MediaPath, error)
}

func NewMediaServerFromConfig

func NewMediaServerFromConfig(mediaServerType string, config map[string]interface{}) (MediaServer, error)

type NZBGet

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

func NewNZBGet

func NewNZBGet(username, password, baseUrl string) (*NZBGet, error)

func NewNZBGetFromConfig

func NewNZBGetFromConfig(configuration map[string]interface{}) (*NZBGet, error)

func (*NZBGet) AddRelease

func (n *NZBGet) AddRelease(release Release) (string, error)

func (*NZBGet) DeleteDownload

func (n *NZBGet) DeleteDownload(identifier string) error

func (*NZBGet) PollDownloads

func (n *NZBGet) PollDownloads(names []string) ([]Download, error)

func (*NZBGet) TestConnection

func (n *NZBGet) TestConnection() error

type Plex

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

func NewPlex

func NewPlex(token, baseUrl string) *Plex

func NewPlexFromConfig

func NewPlexFromConfig(configuration map[string]interface{}) (*Plex, error)

func (*Plex) GetMediaPaths

func (p *Plex) GetMediaPaths() ([]MediaPath, error)

func (*Plex) ImportMedia

func (p *Plex) ImportMedia(mediaPath string) error

func (*Plex) TestConnection

func (p *Plex) TestConnection() error

type QBittorrent

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

func NewQBittorrent

func NewQBittorrent(username, password, baseUrl string) (*QBittorrent, error)

func NewQBittorrentFromConfig

func NewQBittorrentFromConfig(configuration map[string]interface{}) (*QBittorrent, error)

func (*QBittorrent) AddRelease

func (q *QBittorrent) AddRelease(release Release) (string, error)

func (*QBittorrent) DeleteDownload

func (q *QBittorrent) DeleteDownload(identifier string) error

func (*QBittorrent) PollDownloads

func (q *QBittorrent) PollDownloads(identifiers []string) ([]Download, error)

func (*QBittorrent) TestConnection

func (q *QBittorrent) TestConnection() error

type QBittorrentTorrent

type QBittorrentTorrent struct {
	AmountLeft  int    `json:"amount_left"`
	TotalSize   int    `json:"total_size"`
	State       string `json:"state"`
	Hash        string `json:"hash"`
	Name        string `json:"name"`
	ContentPath string `json:"content_path"`
}

Non exhaustive struct

type Release

type Release struct {
	ID           string    `json:"id,omitempty"`
	Title        string    `json:"title,omitempty"`
	Description  string    `json:"description,omitempty"`
	DownloadURL  string    `json:"downloadUrl,omitempty"`
	Categories   []string  `json:"categories,omitempty"`
	Size         int64     `json:"size,omitempty"`
	Seeders      int64     `json:"seeders,omitempty"`
	AirDate      time.Time `json:"airDate,omitempty"`
	PubDate      time.Time `json:"pubDate,omitempty"`
	Age          int       `json:"age,omitempty"`
	RipType      string    `json:"ripType,omitempty"`
	Resolution   string    `json:"resolution,omitempty"`
	Encoding     string    `json:"encoding,omitempty"`
	DownloadType string    `json:"downloadType,omitempty"`
	Indexer      string    `json:"indexer,omitempty"`
	Warnings     []string  `json:"warnings,omitempty"`
	IndexerID    int       `json:"indexerID,omitempty"`
	ImdbID       string    `json:"imdbID,omitempty"`
	ContentType  string    `json:"contentType,omitempty"`

	// HighPriority whether to download with high priority
	HighPriority bool `json:"highPriority,omitempty"`
}

func NewRelease

func NewRelease(id, title, description, downloadURL string, categories []string, size, seeders int64, airDate, pubDate time.Time, indexer *Xnab, imdbID, contentType string) Release

type Service

type Service interface {
	TestConnection() error
	GetConfig() (string, error)
	GetName() string
}

All services that Conductorr communicates with must implement the Service interface. The Service interface provides a means for initializing the service from a configuration string, testing the connection to the service, as well as generating the configuration string for when it needs to be written to the database.

type TorrentMetadata

type TorrentMetadata struct {
	Info bencode.RawMessage `bencode:"info"`
}

type Transmission

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

func NewTransmission

func NewTransmission(username, password, baseUrl string) (*Transmission, error)

func NewTransmissionFromConfig

func NewTransmissionFromConfig(configuration map[string]interface{}) (*Transmission, error)

func (*Transmission) AddRelease

func (t *Transmission) AddRelease(release Release) (string, error)

func (*Transmission) DeleteDownload

func (t *Transmission) DeleteDownload(identifier string) error

func (*Transmission) PollDownloads

func (t *Transmission) PollDownloads(identifiers []string) ([]Download, error)

func (*Transmission) TestConnection

func (t *Transmission) TestConnection() error

type Video

type Video struct {
	Text                  string `xml:",chardata"`
	RatingKey             string `xml:"ratingKey,attr"`
	Key                   string `xml:"key,attr"`
	Guid                  string `xml:"guid,attr"`
	Studio                string `xml:"studio,attr"`
	Type                  string `xml:"type,attr"`
	Title                 string `xml:"title,attr"`
	OriginalTitle         string `xml:"originalTitle,attr"`
	GrandparentTitle      string `xml:"grandparentTitle,attr"`
	ParentTitle           string `xml:"parentTitle,attr"`
	ContentRating         string `xml:"contentRating,attr"`
	Summary               string `xml:"summary,attr"`
	Rating                string `xml:"rating,attr"`
	AudienceRating        string `xml:"audienceRating,attr"`
	Year                  string `xml:"year,attr"`
	Tagline               string `xml:"tagline,attr"`
	Thumb                 string `xml:"thumb,attr"`
	Art                   string `xml:"art,attr"`
	Duration              string `xml:"duration,attr"`
	OriginallyAvailableAt string `xml:"originallyAvailableAt,attr"`
	AddedAt               string `xml:"addedAt,attr"`
	UpdatedAt             string `xml:"updatedAt,attr"`
	AudienceRatingImage   string `xml:"audienceRatingImage,attr"`
	ChapterSource         string `xml:"chapterSource,attr"`
	PrimaryExtraKey       string `xml:"primaryExtraKey,attr"`
	RatingImage           string `xml:"ratingImage,attr"`
	ViewCount             string `xml:"viewCount,attr"`
	LastViewedAt          string `xml:"lastViewedAt,attr"`
	Media                 struct {
		Text                  string `xml:",chardata"`
		ID                    string `xml:"id,attr"`
		Duration              string `xml:"duration,attr"`
		Bitrate               string `xml:"bitrate,attr"`
		Width                 string `xml:"width,attr"`
		Height                string `xml:"height,attr"`
		AspectRatio           string `xml:"aspectRatio,attr"`
		AudioChannels         string `xml:"audioChannels,attr"`
		AudioCodec            string `xml:"audioCodec,attr"`
		VideoCodec            string `xml:"videoCodec,attr"`
		VideoResolution       string `xml:"videoResolution,attr"`
		Container             string `xml:"container,attr"`
		VideoFrameRate        string `xml:"videoFrameRate,attr"`
		AudioProfile          string `xml:"audioProfile,attr"`
		VideoProfile          string `xml:"videoProfile,attr"`
		OptimizedForStreaming string `xml:"optimizedForStreaming,attr"`
		Has64bitOffsets       string `xml:"has64bitOffsets,attr"`
		Part                  struct {
			Text                  string `xml:",chardata"`
			ID                    string `xml:"id,attr"`
			Key                   string `xml:"key,attr"`
			Duration              string `xml:"duration,attr"`
			File                  string `xml:"file,attr"`
			Size                  string `xml:"size,attr"`
			AudioProfile          string `xml:"audioProfile,attr"`
			Container             string `xml:"container,attr"`
			VideoProfile          string `xml:"videoProfile,attr"`
			Has64bitOffsets       string `xml:"has64bitOffsets,attr"`
			HasThumbnail          string `xml:"hasThumbnail,attr"`
			OptimizedForStreaming string `xml:"optimizedForStreaming,attr"`
		} `xml:"Part"`
	} `xml:"Media"`
	Genre []struct {
		Text string `xml:",chardata"`
		Tag  string `xml:"tag,attr"`
	} `xml:"Genre"`
	Director struct {
		Text string `xml:",chardata"`
		Tag  string `xml:"tag,attr"`
	} `xml:"Director"`
	Writer []struct {
		Text string `xml:",chardata"`
		Tag  string `xml:"tag,attr"`
	} `xml:"Writer"`
	Country struct {
		Text string `xml:",chardata"`
		Tag  string `xml:"tag,attr"`
	} `xml:"Country"`
	Role []struct {
		Text string `xml:",chardata"`
		Tag  string `xml:"tag,attr"`
	} `xml:"Role"`
}

type Xnab

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

func NewXnab

func NewXnab(userID int, apiKey, baseUrl, name, downloadType string) *Xnab

func (*Xnab) SearchEpisode

func (x *Xnab) SearchEpisode(seasonNum, episodeNum int, showTitle string, tvdbID *int, imdbID *string) ([]Release, error)

func (*Xnab) SearchMovie

func (x *Xnab) SearchMovie(movieTitle string, year int, imdbID *string) ([]Release, error)

func (*Xnab) SearchSeason

func (x *Xnab) SearchSeason(seasonNum int, showTitle string, tvdbID *int, imdbID *string) ([]Release, error)

func (*Xnab) SyncRSS

func (x *Xnab) SyncRSS(lastRSSID string) ([]Release, error)

func (*Xnab) TestConnection

func (x *Xnab) TestConnection() error

Jump to

Keyboard shortcuts

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