diff --git a/controllers/webhookController.go b/controllers/webhookController.go index 9efc62e..2ac21a2 100644 --- a/controllers/webhookController.go +++ b/controllers/webhookController.go @@ -106,9 +106,11 @@ func OnPubStop(c *fiber.Ctx) error { now := time.Now() duration := now.Sub(transm.StartTime) + minutes := float64(duration) / float64(time.Minute) + // TODO: Updates the transmission on database for future calculation of remaining daily time - msg := fmt.Sprintf("Transmissão encerrada: Duration %s\n", duration) + msg := fmt.Sprintf("Transmissão encerrada: Duration %d\n", int(minutes)) services.AddTransmissionlog(p.StreamName, msg) return c.SendString("On_Pub_Stop: " + string(c.Body())) diff --git a/services/channelservices.go b/services/channelservices.go index aaddbd1..f0ea950 100644 --- a/services/channelservices.go +++ b/services/channelservices.go @@ -14,6 +14,8 @@ func VerifyTransmissionsLimits() { continue } + AddTransmissionlog(channelname, "Verificando expiração de transmissão") + // TODO: Implementar verificação de limite de transmissão diária (ou seja, quanto já foi transmitido HOJE) if time.Now().After(currentTransmission.Limit) { AddTransmissionlog(channelname, "Limite de transmissão diária atingido") @@ -48,7 +50,7 @@ func VerifyTransmissionAuthorization(channelname, sessionid, transmissionkey str } // If the channel expiration date is reached, kick the session - if channel.DateLimit.After(time.Now()) { + if time.Now().After(channel.DateLimit) { AddTransmissionlog(channelname, "Canal com data de expiração vencida") utils.KickSession(channelname, sessionid) return false, currentTransmission