actually count things properly
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
stryan 2021-10-26 14:33:22 -04:00
parent 67fe7dea38
commit 6f22f580dd
2 changed files with 11 additions and 6 deletions

View File

@ -152,10 +152,7 @@ func main() {
for _, v := range vtubers {
v.Update()
if v.IsLive() {
CurrStreamCnt = CurrStreamCnt + 1
if CurrStreamCnt > MostStreamCnt {
MostStreamCnt = CurrStreamCnt
}
for _, room := range rooms {
//check to see if already embeded
var content YoutubeWidget
@ -182,7 +179,6 @@ func main() {
} else {
//Not live, check to see if there's any embeds and remove them
for _, room := range rooms {
CurrStreamCnt = CurrStreamCnt - 1
var content YoutubeWidget
err = client.StateEvent(room, event.NewEventType("im.vector.modular.widgets"), "dimension-m.video-simp-"+v.Name, &content)
if err == nil && content.ID != "" {

View File

@ -78,13 +78,22 @@ 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
v.TotalStreams = v.TotalStreams + 1
found = true
}
}
if !found {
if v.CurrentStream != "" {
CurrStreamCnt = CurrStreamCnt - 1
}
v.CurrentStream = ""
v.CurrentStreamTitle = ""
}