-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser.go
More file actions
30 lines (26 loc) · 608 Bytes
/
parser.go
File metadata and controls
30 lines (26 loc) · 608 Bytes
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
package main
import (
"encoding/json"
"io"
"log"
)
//Parser of nats messages
type Parser struct {
App *App
Logger *log.Logger
Type string
Output io.WriteCloser
}
// Parse nats message and take action
func (p *Parser) Parse(b []byte) {
var programs Programs
err := json.Unmarshal(b, &programs)
if err != nil {
p.Logger.Printf("Parser: %v", err)
}
if p.Type == "ffmpeg" {
(&Supervisor{App: p.App, Logger: p.Logger, Output: p.Output}).GenerateFFMPEG(programs.VideoFfmpeg)
} else {
(&Supervisor{App: p.App, Logger: p.Logger, Output: p.Output}).GenerateCache(programs.VideoCache)
}
}