From 84c158105e2b88abf2504efbaa975747076041e4 Mon Sep 17 00:00:00 2001 From: OldTyT Date: Sun, 23 Feb 2025 14:04:40 +0300 Subject: [PATCH] fix: don't send zero video file --- internal/frigate/frigate.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/frigate/frigate.go b/internal/frigate/frigate.go index ca1a2e3..741fac0 100644 --- a/internal/frigate/frigate.go +++ b/internal/frigate/frigate.go @@ -40,9 +40,9 @@ type EventsStruct []struct { RetainIndefinitely bool `json:"retain_indefinitely"` StartTime float64 `json:"start_time"` // SubLabel []any `json:"sub_label"` - Thumbnail string `json:"thumbnail"` - TopScore interface{} `json:"top_score"` - Zones []any `json:"zones"` + Thumbnail string `json:"thumbnail"` + TopScore interface{} `json:"top_score"` + Zones []any `json:"zones"` } type EventStruct struct { @@ -66,9 +66,9 @@ type EventStruct struct { RetainIndefinitely bool `json:"retain_indefinitely"` StartTime float64 `json:"start_time"` // SubLabel []any `json:"sub_label"` - Thumbnail string `json:"thumbnail"` - TopScore interface{} `json:"top_score"` - Zones []any `json:"zones"` + Thumbnail string `json:"thumbnail"` + TopScore interface{} `json:"top_score"` + Zones []any `json:"zones"` } var Events EventsStruct @@ -264,7 +264,7 @@ func SendMessageEvent(FrigateEvent EventStruct, bot *tgbotapi.BotAPI) { ErrorSend("Error receiving information about the clip file: "+err.Error(), bot, FrigateEvent.ID) } - if videoInfo.Size() < 52428800 { + if videoInfo.Size() < 52428800 && videoInfo.Size() > 0 { // Telegram don't send large file see for more: https://github.com/OldTyT/frigate-telegram/issues/5 // Add clip to media group MediaClip := tgbotapi.NewInputMediaVideo(tgbotapi.FilePath(FilePathClip))