news

package
v0.0.0-...-ae79001 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NationalSources = []Nation{}/* 114 elements not displayed */

Functions

func Render

func Render(index Index, maxScore float64) []byte

func UpdateLoop

func UpdateLoop(dir string, notify chan<- Notification, infoLog, errorLog Logger)

Types

type Index

type Index []*IndexItem

func (Index) Len

func (a Index) Len() int

func (Index) Less

func (a Index) Less(i, j int) bool

func (Index) Swap

func (a Index) Swap(i, j int)

type IndexItem

type IndexItem struct {
	Nation    *Nation
	Headline  string
	URL       *url.URL
	Timestamp string
	Score     float64
}

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

type Nation

type Nation struct {
	Name      string
	NameToken string // Initialized by init()
	Flag      string
	Sources   []Source
}

type Notification

type Notification struct {
	GzipIndexFilename string
}

type Result

type Result struct {
	Nation *Nation
	Source Source
	Item   *gofeed.Item
	Score  float64
}

type ReverseItemOrdering

type ReverseItemOrdering struct {
	Items []*gofeed.Item
	Order []int64
}

func (ReverseItemOrdering) Len

func (x ReverseItemOrdering) Len() int

func (ReverseItemOrdering) Less

func (x ReverseItemOrdering) Less(i, j int) bool

func (ReverseItemOrdering) Swap

func (x ReverseItemOrdering) Swap(i, j int)

type S

type S struct {
	// contains filtered or unexported fields
}

S is the simplest Source implementation.

func (S) Headline

func (x S) Headline(item *gofeed.Item) string

func (S) Match

func (x S) Match(*gofeed.Item) bool

func (S) URL

func (x S) URL() string

type Source

type Source interface {
	URL() string
	Headline(*gofeed.Item) string
	Match(*gofeed.Item) bool
}

func ChooseFrom

func ChooseFrom(nation *Nation, log Logger) (topSource Source, topItem *gofeed.Item, topScore float64)

ChooseFrom a nation's news sources. The algorithm looks at each source separately.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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