all repos

rss-tools @ 71f9578bfe2969b6b22984c4264c8bf6c067e608

get rss feed from sources that(i need and) dont provide one

rss-tools/main.go (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
add weather source, 1 month ago
1
package main
2
3
import (
4
	"context"
5
	"flag"
6
7
	"go.etcd.io/bbolt"
8
	"olexsmir.xyz/rss-tools/app"
9
	"olexsmir.xyz/rss-tools/sources/moviefeed"
10
	"olexsmir.xyz/rss-tools/sources/telegram"
11
	"olexsmir.xyz/rss-tools/sources/weather"
12
	"olexsmir.xyz/rss-tools/sources/ztoe"
13
)
14
15
func main() {
16
	var cfgPath, dbPath string
17
	flag.StringVar(&cfgPath, "config", "./config.json", "Path to config file")
18
	flag.StringVar(&dbPath, "db", "./db", "Path to local database")
19
	flag.Parse()
20
21
	if err := run(context.Background(), cfgPath, dbPath); err != nil {
22
		panic(err)
23
	}
24
}
25
26
func run(ctx context.Context, cfgPath, dbPath string) error {
27
	db, err := bbolt.Open(dbPath, 0o600, nil)
28
	if err != nil {
29
		return err
30
	}
31
	defer db.Close()
32
33
	cfg, err := app.NewConfig(cfgPath)
34
	if err != nil {
35
		return err
36
	}
37
38
	app := app.New(cfg, db)
39
	_ = ztoe.Register(app)
40
	_ = telegram.Register(app)
41
	_ = moviefeed.Register(app)
42
	_ = weather.Register(app)
43
44
	return app.Start(ctx)
45
}