unpackerpoller

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MISSING = ExtractStatus(iota)
	QUEUED
	EXTRACTING
	EXTRACTFAILED
	EXTRACTFAILED2
	EXTRACTED
	IMPORTED
	DELETING
	DELETEFAILED
	DELETED
)

Extract Statuses.

Variables

View Source
var Version = "development"

Version of the application. Injected at build time.

Functions

func FindRarFiles added in v0.5.2

func FindRarFiles(path string) []string

FindRarFiles returns all the rar files in a path. This attempts to grab only the first file in a multi-part archive. Sometimes there are multiple archives, so if the archive does not have "part" followed by a number in the name, then it will be considered an independent archive. Some packagers seem to use different naming schemes, so this will need to be updated as time progresses. So far it's working well. -dn2@8/3/19

func Start

func Start() (err error)

Start runs the app.

Types

type Config

type Config struct {
	Debug              bool           `json:"debug" toml:"debug" xml:"debug" yaml:"debug"`
	Interval           starr.Duration `json:"interval" toml:"interval" xml:"interval" yaml:"interval"`
	Timeout            starr.Duration `json:"timeout" toml:"timeout" xml:"timeout" yaml:"timeout"`
	DeleteDelay        starr.Duration `json:"delete_delay" toml:"delete_delay" xml:"delete_delay" yaml:"delete_delay"`
	ConcurrentExtracts uint           `json:"concurrent_extracts" toml:"concurrent_extracts" xml:"concurrent_extracts" yaml:"concurrent_extracts"`
	Deluge             *deluge.Config `json:"deluge" toml:"deluge" xml:"deluge" yaml:"deluge"`
	Sonarr             *starr.Config  `json:"sonarr,_omitempty" toml:"sonarr" xml:"sonarr" yaml:"sonarr,_omitempty"`
	Radarr             *starr.Config  `json:"radarr,_omitempty" toml:"radarr" xml:"radarr" yaml:"radarr,_omitempty"`
	Lidarr             *starr.Config  `json:"lidarr,_omitempty" toml:"lidarr" xml:"lidarr" yaml:"lidarr,_omitempty"`
}

Config defines the configuration data used to start the application.

type ExtractStatus

type ExtractStatus uint8

ExtractStatus is our enum for an extract's status.

func (ExtractStatus) String

func (status ExtractStatus) String() string

String makes ExtractStatus human readable.

type Extracts

type Extracts struct {
	Path    string
	App     string
	Files   []string
	Status  ExtractStatus
	Updated time.Time
}

Extracts holds data for files being extracted.

type Flags added in v0.5.0

type Flags struct {
	ConfigFile string
	// contains filtered or unexported fields
}

Flags are our CLI input flags.

type History added in v0.5.0

type History struct {
	sync.RWMutex
	Finished uint
	Map      map[string]Extracts
}

History holds the history of extracted items.

type RadarrQ added in v0.5.0

type RadarrQ struct {
	sync.RWMutex
	List []*starr.RadarQueue
}

RadarrQ holds the queued items in the Radarr activity list.

type SonarrQ added in v0.5.0

type SonarrQ struct {
	sync.RWMutex
	List []*starr.SonarQueue
}

SonarrQ holds the queued items in the Sonarr activity list.

type UnpackerPoller added in v0.5.0

type UnpackerPoller struct {
	*Flags
	*Config
	*deluge.Deluge
	*Xfers
	*SonarrQ
	*RadarrQ
	*History
	SigChan  chan os.Signal
	StopChan chan bool
}

UnpackerPoller stores all the running data.

func New added in v0.5.0

func New() *UnpackerPoller

New returns an UnpackerPoller struct full of defaults. An empty struct will surely cause you pain, so use this!

func (*UnpackerPoller) CheckExtractDone added in v0.5.0

func (u *UnpackerPoller) CheckExtractDone()

CheckExtractDone checks if an extracted item has been imported.

func (*UnpackerPoller) CheckRadarrQueue added in v0.5.0

func (u *UnpackerPoller) CheckRadarrQueue()

CheckRadarrQueue passes completed Radarr-queued downloads to the HandleCompleted method.

func (*UnpackerPoller) CheckSonarrQueue added in v0.5.0

func (u *UnpackerPoller) CheckSonarrQueue()

CheckSonarrQueue passes completed Sonarr-queued downloads to the HandleCompleted method.

func (*UnpackerPoller) CreateStatus added in v0.5.0

func (u *UnpackerPoller) CreateStatus(name, path string, app string, files []string)

CreateStatus for a newly-started extraction. It will also overwrite.

func (*UnpackerPoller) DeLogf added in v0.5.0

func (u *UnpackerPoller) DeLogf(msg string, v ...interface{})

DeLogf writes Debug log lines.

func (*UnpackerPoller) HandleCompleted added in v0.5.0

func (u *UnpackerPoller) HandleCompleted(name, app string)

HandleCompleted checks if a completed sonarr or radarr item needs to be extracted.

func (*UnpackerPoller) HandleExtractDone added in v0.5.0

func (u *UnpackerPoller) HandleExtractDone(app, name string, status ExtractStatus, files []string, elapsed time.Duration) ExtractStatus

HandleExtractDone checks if files should be deleted.

func (*UnpackerPoller) ParseConfig added in v0.5.0

func (u *UnpackerPoller) ParseConfig() (*UnpackerPoller, error)

ParseConfig parses and returns our configuration data.

func (*UnpackerPoller) ParseFlags added in v0.5.0

func (u *UnpackerPoller) ParseFlags() *UnpackerPoller

ParseFlags turns CLI args into usable data.

func (*UnpackerPoller) PollAllApps added in v0.5.0

func (u *UnpackerPoller) PollAllApps()

PollAllApps Polls Deluge, Sonarr and Radarr. All at the same time.

func (*UnpackerPoller) PollChange added in v0.5.0

func (u *UnpackerPoller) PollChange()

PollChange runs other tasks. Those tasks: a) look for things to extract, b) look for things to delete. This runs more often because of the cleanup tasks. It doesn't poll external data, unless it finds something to extract.

func (*UnpackerPoller) PollDeluge added in v0.5.0

func (u *UnpackerPoller) PollDeluge() error

PollDeluge at an interval and save the transfer list to r.Deluge

func (*UnpackerPoller) PollRadarr added in v0.5.0

func (u *UnpackerPoller) PollRadarr() error

PollRadarr saves the Radarr Queue to r.RadarrQ

func (*UnpackerPoller) PollSonarr added in v0.5.0

func (u *UnpackerPoller) PollSonarr() error

PollSonarr saves the Sonarr Queue to r.SonarrQ

func (*UnpackerPoller) Run added in v0.5.0

func (u *UnpackerPoller) Run()

Run starts the go routines and waits for an exit signal.

func (*UnpackerPoller) Stop added in v0.5.0

func (u *UnpackerPoller) Stop()

Stop brings the go routines to a halt.

func (*UnpackerPoller) UpdateStatus added in v0.5.0

func (u *UnpackerPoller) UpdateStatus(name string, status ExtractStatus, fileList []string)

UpdateStatus for an on-going tracked extraction.

type Xfers added in v0.5.0

type Xfers struct {
	sync.RWMutex
	Map map[string]*deluge.XferStatusCompat
}

Xfers holds the last list of transferred pulled form Deluge.

Jump to

Keyboard shortcuts

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