app

package
v0.0.0-...-96d54e8 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = ConfigFile{
	Path: GetPath(),
	Config: Config{
		Subs:  []Subscription{},
		Logs:  "logs/log.txt",
		Cache: "cache",
	},
}

DefaultConfig is the configuration that will be saved in the configured path if no file is found on LoadConfig

Functions

func GetPath

func GetPath() string

GetPath returns the config path as specified in env variable LAST_CONFIG_PATH_ON_THE_LEFT If empty the fallback is ~/.config/LastPlayer/config.yaml

Types

type Config

type Config struct {
	Subs  []Subscription `yaml:"subs"`
	Logs  string         `yaml:"logs"`
	Cache string         `yaml:"cache"`
}

Config represents all the configuration contained in a config file. It specifies the config schema.

var LoadedConfig Config

func (Config) GetByAlias

func (c Config) GetByAlias(alias string) Subscription

GetByAlias returns the Subscription associated to the passed alias

type ConfigFile

type ConfigFile struct {
	Path   string
	Config Config
}

ConfigFile represents a file containing configuration

func LoadConfig

func LoadConfig() (*ConfigFile, error)

LoadConfig checks the environment for a LAST_CONFIG_PATH_ON_THE_LEFT variable for a user supplied config path, if empty it puts it into $HOME/.config/LastPlayer. If no config is found at the specified path, the default config is placed there.

func (*ConfigFile) Include

func (s *ConfigFile) Include(alias string, url string) error

Include allows the application to add subscriptions to the config

func (*ConfigFile) Save

func (s *ConfigFile) Save() error

Save updates the config file that the config was loaded from with any changes

type Subscription

type Subscription struct {
	Alias string `yaml:"alias"`
	Url   string `yaml:"url"`
}

Subscription represents a single alias <-> url pair. These are the items that show up in the feeds menu

Jump to

Keyboard shortcuts

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