ytbackup

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigDefaults = `` /* 208-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type AddCommand

type AddCommand struct {
	Command
	Force bool `short:"f" long:"force" description:"Force adding existing videos (e.g. to retry failed downloads)"`
	Args  struct {
		IDs []string `positional-arg-name:"ID"`
	} `positional-args:"1"`
}

func (*AddCommand) Execute

func (cmd *AddCommand) Execute([]string) error

type Browser

type Browser struct {
	Executable string            `yaml:"executable"`
	DebugPort  int               `yaml:"debug_port"`
	DataDir    string            `yaml:"data_dir"`
	ExtraArgs  map[string]string `yaml:"extra_args"`
}

func (*Browser) New

func (bcfg *Browser) New() (*browser.Browser, error)

type Command

type Command struct {
	DB          *sql.DB
	Index       *index.Index
	Storages    *storages.Storages
	Config      *Config
	Wg          *sync.WaitGroup
	Ctx         context.Context
	CriticalCtx context.Context
}

Command is a common part of all subcommands.

func (*Command) Close

func (cmd *Command) Close()

func (*Command) Init

func (cmd *Command) Init(opts interface{}) error

type Config

type Config struct {
	Sources struct {
		History struct {
			Enable bool
		}
		Playlists      map[string]string
		UpdateInterval time.Duration `yaml:"update_interval"`
		MaxDuration    time.Duration `yaml:"max_duration"`
	}
	Dirs     Dirs
	Storages []struct {
		Path string
	}
	Youtube struct {
		OAuth OAuth `yaml:"oauth"`
	}
	Python struct {
		Executable string `yaml:"executable"`
		YoutubeDL  struct {
			Lite           bool
			Version        string
			UpdateInterval time.Duration `yaml:"update_interval"`
			Options        map[string]interface{}
		} `yaml:"youtube-dl"`
	}
	Browser Browser
}

func (*Config) Validate

func (cfg *Config) Validate() error

type Dirs

type Dirs struct {
	Cache string
	Data  string
}

func (*Dirs) Logs

func (dirs *Dirs) Logs() string

func (*Dirs) Metadata

func (dirs *Dirs) Metadata() string

func (*Dirs) Python

func (dirs *Dirs) Python() string

type ImportCommand

type ImportCommand struct {
	Args struct {
		File string `positional-arg-name:"FILE"`
	} `positional-args:"1" required:"1"`
	Command
}

func (*ImportCommand) Execute

func (cmd *ImportCommand) Execute([]string) error

type ListCommand

type ListCommand struct {
	Status  string `` /* 127-byte string literal not displayed */
	JSON    bool   `long:"json" description:"JSON output"`
	NoTrunc bool   `long:"no-trunc" description:"Don't truncate output"`
	Command
}

func (*ListCommand) Execute

func (cmd *ListCommand) Execute([]string) error

type OAuth

type OAuth struct {
	AccessToken  string    `json:"access_token" yaml:"access_token"`
	TokenType    string    `json:"token_type,omitempty" yaml:"token_type,omitempty"`
	RefreshToken string    `json:"refresh_token,omitempty" yaml:"refresh_token,omitempty"`
	Expiry       time.Time `json:"expiry,omitempty" yaml:"expiry,omitempty"`
}

func NewCredentials

func NewCredentials(token *oauth2.Token) *OAuth

func (*OAuth) Token

func (cr *OAuth) Token() *oauth2.Token

type Options

type Options struct {
	ConfigPath string `short:"c" long:"config" description:"Config path" env:"YTBACKUP_CONFIG"`
	Debug      bool   `long:"debug" description:"Enable debug logging" env:"YTBACKUP_DEBUG"`
}

Options is a group of common options for all subcommands.

type SetupCommand

type SetupCommand struct {
	Command
}

func (*SetupCommand) Execute

func (cmd *SetupCommand) Execute([]string) error

type VersionCommand

type VersionCommand struct {
	Command
}

func (*VersionCommand) Execute

func (cmd *VersionCommand) Execute([]string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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