config

package
v0.0.0-...-9e29a38 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const BlockButton = "BLOCK_BUTTON"

BlockButton is an env var name for i3 block button

View Source
const BlockButtonRightClick = "3"

BlockButtonRightClick is the value for right click

View Source
const EnvUsername = "I3_NOTIFY_MOE_USERNAME"

EnvUsername is an env var name for username

View Source
const StateFilename = "state"

StateFilename is where the state is peristed at (released, today, unreleased)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Username    string
	BlockButton string
}

Configuration contains environment variables that are set and influence the behavior of the application

func (Configuration) IsRightButtonClicked

func (cfg Configuration) IsRightButtonClicked() bool

IsRightButtonClicked checks whether the environment variable for block button indicates a right button click

type ConfigurationService

type ConfigurationService interface {
	LoadPersistedState(reader io.Reader) error
	PersistState(writer io.Writer) error
	SetStateItems(stateItems []StateItem) error
	GetConfiguration() *Configuration
	GetState() *State
}

ConfigurationService interface for configuration

func NewConfigurationService

func NewConfigurationService() ConfigurationService

NewConfigurationService creates a new ConfigurationService

type State

type State struct {
	ReleasedAnimes   []StateItem
	TodayAnimes      []StateItem
	UnreleasedAnimes []StateItem
}

State contains a list of each category of queried animes (released, today, unreleasd)

func (*State) String

func (s *State) String() string

type StateItem

type StateItem struct {
	Title    string
	Episode  int
	DateTime string
}

StateItem describes an anime

func (StateItem) DatetimeToDate

func (si StateItem) DatetimeToDate(location *time.Location) (string, error)

DatetimeToDate converts datetime string to a timezone aware datetime object and extracts the date

func (StateItem) DatetimeToTime

func (si StateItem) DatetimeToTime(location *time.Location) (string, error)

DatetimeToTime converts datetime string to a timezone aware datetime object and extracts the time

func (*StateItem) FromString

func (si *StateItem) FromString(str string) error

FromString deserializes a StateItem string

func (StateItem) String

func (si StateItem) String() string

String() serializes the StateItem to a string

Jump to

Keyboard shortcuts

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