models

package module
v0.0.0-...-8d19245 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCompletedJobRemoval = time.Duration(-15) * time.Minute

DefaultCompletedJobRemoval ..

View Source
var DefaultDownloadDir = "/media"

DefaultDownloadDir specifies default location for downloadedfiles

View Source
var DefaultNrWorkers = 2

DefaultNrWorkers ..

View Source
var SvtDLLocation = "/usr/bin/svtplay-dl"

SvtDLLocation is describing the location of SvtDL

Functions

func AddJob

func AddJob(job Job)

AddJob ...

func AllJobs

func AllJobs() map[string]Job

AllJobs ...

func Max

func Max(x int, y int) int

Max returns the larger of x or y.

Types

type Download

type Download struct {
	URL             string            `json:"url"`
	Started         *time.Time        `json:"started"`
	Completed       *time.Time        `json:"completed"`
	Running         bool              `json:"running"`
	Done            bool              `json:"done"`
	FindCmd         *cmd.Cmd          `json:"-"`
	StatusChan      <-chan cmd.Status `json:"-"`
	Ticker          *time.Ticker      `json:"-"`
	StdOut          []string          `json:"std_out"`
	StdErr          []string          `json:"std_err"`
	Error           bool              `json:"error"`
	Filename        *string           `json:"filename"`
	AudioETA        *string           `json:"audio_eta"`
	VideoETA        *string           `json:"video_eta"`
	AudioDownloaded bool              `json:"audio_ready"`
	VideoDownloaded bool              `json:"video_ready"`
	AudioStarted    bool              `json:"-"`
	VideoStarted    bool              `json:"-"`
	FullStdErr      []string          `json:"-"`
}

Download struct containing info regarding a executable command

func AddDownload

func AddDownload(url string) Download

AddDownload ..

func DownloadsAll

func DownloadsAll() []Download

DownloadsAll to retrive all downloders

func (*Download) Start

func (d *Download) Start()

Start to start download

func (Download) Stop

func (d Download) Stop() error

Stop ...

type Job

type Job struct {
	UUID     string
	Download *Download
}

Job ...

func (Job) Completed

func (j Job) Completed() bool

Completed ...

func (Job) GetCompletedTime

func (j Job) GetCompletedTime() *time.Time

GetCompletedTime ...

func (Job) Running

func (j Job) Running() bool

Running ...

func (Job) Start

func (j Job) Start() error

Start ..

func (Job) Stop

func (j Job) Stop() error

Stop ..

type Scheduler

type Scheduler struct {
	Workers int
	// contains filtered or unexported fields
}

Scheduler ...

func NewScheduler

func NewScheduler() *Scheduler

NewScheduler ...

func (*Scheduler) AddJob

func (s *Scheduler) AddJob(job Job)

AddJob starts goroutine which constantly calls provided job with interval delay

func (*Scheduler) GetJobByUUID

func (s *Scheduler) GetJobByUUID(uuid string) *Job

GetJobByUUID ...

func (*Scheduler) GetJobs

func (s *Scheduler) GetJobs() []Job

GetJobs ...

func (*Scheduler) Start

func (s *Scheduler) Start()

Start ...

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Stop ...

Jump to

Keyboard shortcuts

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