move count logic to embed section, cuz we know it's right there
This commit is contained in:
parent
2eff2a3559
commit
4ca54eb7db
6
main.go
6
main.go
@ -178,6 +178,11 @@ func main() {
|
||||
log.Println("error embeding video")
|
||||
log.Println(err)
|
||||
}
|
||||
v.TotalStreams = v.TotalStreams + 1
|
||||
CurrStreamCnt = CurrStreamCnt + 1
|
||||
if CurrStreamCnt > MostStreamCnt {
|
||||
MostStreamCnt = CurrStreamCnt
|
||||
}
|
||||
log.Printf("Embed stream %v for %v ", resp, v.Name)
|
||||
}
|
||||
}
|
||||
@ -193,6 +198,7 @@ func main() {
|
||||
log.Println("error removed video embed")
|
||||
log.Println(err)
|
||||
}
|
||||
CurrStreamCnt = CurrStreamCnt - 1
|
||||
log.Printf("Embed stream %v removed %v", resp, v.Name)
|
||||
}
|
||||
}
|
||||
|
10
vtuber.go
10
vtuber.go
@ -78,22 +78,12 @@ func (v *Vtuber) Update() error {
|
||||
found := false
|
||||
for _, s := range sl.Streams {
|
||||
if s.Status == "live" {
|
||||
if v.CurrentStream != s.ID {
|
||||
v.TotalStreams = v.TotalStreams + 1
|
||||
CurrStreamCnt = CurrStreamCnt + 1
|
||||
if CurrStreamCnt > MostStreamCnt {
|
||||
MostStreamCnt = CurrStreamCnt
|
||||
}
|
||||
}
|
||||
v.CurrentStream = s.ID
|
||||
v.CurrentStreamTitle = s.Title
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
if v.CurrentStream != "" {
|
||||
CurrStreamCnt = CurrStreamCnt - 1
|
||||
}
|
||||
v.CurrentStream = ""
|
||||
v.CurrentStreamTitle = ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user