actually count things properly
All checks were successful
continuous-integration/drone/tag Build is passing
All checks were successful
continuous-integration/drone/tag Build is passing
This commit is contained in:
parent
67fe7dea38
commit
6f22f580dd
6
main.go
6
main.go
@ -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 != "" {
|
||||
|
11
vtuber.go
11
vtuber.go
@ -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 = ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user