-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
45 lines (35 loc) · 822 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/ghokun/appletv3-iptv/internal/config"
"github.com/ghokun/appletv3-iptv/internal/logging"
"github.com/ghokun/appletv3-iptv/internal/m3u"
"github.com/ghokun/appletv3-iptv/internal/server"
)
func main() {
configFilePtr := flag.String("config", "config.yaml", "Config file path")
versionPtr := flag.Bool("v", false, "prints current application version")
flag.Parse()
if *versionPtr {
fmt.Println(config.Version)
os.Exit(0)
}
err := config.LoadConfig(*configFilePtr)
if err != nil {
log.Fatal(err)
}
if config.Current.LogToFile {
logging.EnableLoggingToFile()
}
logging.Info("Starting appletv3-iptv")
if config.Current.M3UPath != "" {
err := m3u.GeneratePlaylist()
if err != nil {
logging.Warn(err)
}
}
server.Serve()
}