Skip to content

Commit

Permalink
only send notifications for video uploads (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
graphaelli authored Mar 4, 2021
1 parent 4d711bb commit 49439d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (z *Config) Archive(ctx context.Context, meeting zoom.Meeting, params runPa
// download & upload serially for now
z.logger.Printf("archiving meeting %d to %s (https://drive.google.com/drive/folders/%s)",
meeting.ID, meetingFolder.Name, meetingFolder.Id)
uploaded := false
notifyUpload := false
for _, f := range meeting.RecordingFiles {
//check if recording file duration is shorter than minimum
start, err := time.Parse(time.RFC3339, f.RecordingStart)
Expand Down Expand Up @@ -440,9 +440,11 @@ func (z *Config) Archive(ctx context.Context, meeting zoom.Meeting, params runPa
}
curArchMeeting.fileNumber++
z.logger.Printf("uploaded %q to %s/%s", name, parent.Name, meetingFolder.Name)
uploaded = true
if strings.ToLower(f.FileType) == "mp4" {
notifyUpload = true
}
}
if uploaded && action.Slack != "" && z.slackClient != nil {
if notifyUpload && action.Slack != "" && z.slackClient != nil {
slackSpan, ctx := apm.StartSpan(ctx, "slack", "app")
body := fmt.Sprintf("%s recording now available: https://drive.google.com/drive/folders/%s", meeting.Topic, meetingFolder.Id)
channel, _, text, err := z.slackClient.SendMessageContext(ctx, action.Slack, slackapi.MsgOptionText(body, true))
Expand Down

0 comments on commit 49439d0

Please sign in to comment.