core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type CamModule

type CamModule interface {
	Capture() (image.Image, error)
	Send(image.Image) error
	SendTo(image.Image, int) error
	HandleCommands(chan int) error
}

type Config

type Config struct {
	General   GeneralConfig
	Telegram  TelegramConfig
	Snapshots SnapshotConfig
	Videos    VideoConfig
}

type GeneralConfig

type GeneralConfig struct {
	Server     string
	Port       string
	IpFilter   string `mapstructure:"ip_filter"`
	RateFilter int    `mapstructure:"max_requests_per_hr"`
}

type SnapshotConfig

type SnapshotConfig struct {
	Enabled     bool
	IntervalS   int         `mapstructure:"interval_s"`
	ActiveTime  TimerConfig `mapstructure:"active_time"`
	SnapshotUrl string      `mapstructure:"snapshot_url"`
}

type Snapshots

type Snapshots struct {
	Cfg    *Config
	Client *http.Client
	TgBot  *tgbotapi.BotAPI
}

func (*Snapshots) Capture

func (a *Snapshots) Capture() (image.Image, error)

func (*Snapshots) HandleCommands

func (a *Snapshots) HandleCommands(ch chan int) error

func (*Snapshots) Send

func (a *Snapshots) Send(img image.Image) error

func (*Snapshots) SendTo

func (a *Snapshots) SendTo(img image.Image, replyId int) error

type TelegramConfig

type TelegramConfig struct {
	BotName string `mapstructure:"bot_name"`
	ApiKey  string `mapstructure:"api_key"`
	ChatId  int64  `mapstructure:"chat_id"`
}

type TimerConfig

type TimerConfig struct {
	FromTime string `mapstructure:"from_time"`
	ToTime   string `mapstructure:"to_time"`
}

type VideoConfig

type VideoConfig struct {
	Enabled    bool
	IntervalS  int         `mapstructure:"interval_s"`
	LengthS    int         `mapstructure:"length_s"`
	ActiveTime TimerConfig `mapstructure:"active_time"`
}

Jump to

Keyboard shortcuts

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