config

package
v1.0.1-0...-a7812af Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides the configuration support for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Feeds  map[string]Feed `yaml:"feeds"`
	System struct {
		UpdateInterval      time.Duration `yaml:"update"`
		HTTPResponseTimeout time.Duration `yaml:"http_response_timeout"`
		MaxItems            int           `yaml:"max_per_feed"`
		MaxTotal            int           `yaml:"max_total"`
		MaxKeepInDB         int           `yaml:"max_keep"`
		Concurrent          int           `yaml:"concurrent"`
		BaseURL             string        `yaml:"base_url"`
	} `yaml:"system"`

	YouTube struct {
		DlTemplate      string             `yaml:"dl_template"`
		BaseChanURL     string             `yaml:"base_chan_url"`
		BasePlaylistURL string             `yaml:"base_playlist_url"`
		Channels        []youtube.FeedInfo `yaml:"channels"`
		BaseURL         string             `yaml:"base_url"`
		UpdateInterval  time.Duration      `yaml:"update"`
		MaxItems        int                `yaml:"max_per_channel"`
		FilesLocation   string             `yaml:"files_location"`
		RSSLocation     string             `yaml:"rss_location"`
		SkipShorts      time.Duration      `yaml:"skip_shorts"`
		DisableUpdates  bool               `yaml:"disable_updates"`
	} `yaml:"youtube"`
}

Conf for feeds config yml

func Load

func Load(fname string) (res *Conf, err error)

Load config from file

func SingleFeed

func SingleFeed(feedURL, ch string, updateInterval time.Duration) *Conf

SingleFeed returns single feed "fake" config for no-config mode

type Feed

type Feed struct {
	Title           string   `yaml:"title"`
	Description     string   `yaml:"description"`
	Link            string   `yaml:"link"`
	Image           string   `yaml:"image"`
	Language        string   `yaml:"language"`
	TelegramChannel string   `yaml:"telegram_channel"`
	Filter          Filter   `yaml:"filter"`
	Sources         []Source `yaml:"sources"`
	ExtendDateTitle string   `yaml:"ext_date"`
	Author          string   `yaml:"author"`
	OwnerEmail      string   `yaml:"owner_email"`
}

Feed defines config section for a feed~

type Filter

type Filter struct {
	Title  string `yaml:"title"`
	Invert bool   `yaml:"invert"`
}

Filter defines feed section for a feed filter~

func (*Filter) Skip

func (filter *Filter) Skip(item feed.Item) (bool, error)

Skip items with this regexp

type Source

type Source struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

Source defines config section for source

type YTChannel

type YTChannel struct {
	ID   string
	Name string
}

YTChannel defines youtube channel config

Jump to

Keyboard shortcuts

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