move count logic to embed section, cuz we know it's right there
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
stryan 2021-12-01 13:57:21 -05:00
parent 2eff2a3559
commit 4ca54eb7db
2 changed files with 6 additions and 10 deletions

View File

@ -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)
}
}

View File

@ -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 = ""
}