Skip to content

Commit

Permalink
fix: don't send zero video file
Browse files Browse the repository at this point in the history
  • Loading branch information
OldTyT committed Feb 23, 2025
1 parent 8ed5f32 commit 84c1581
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/frigate/frigate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 84c1581

Please sign in to comment.