Skip to content

Commit

Permalink
fix(video): use random video id if vod not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibbp committed Jan 5, 2024
1 parent b1679ca commit 1b4d525
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/activities/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,18 +882,17 @@ func ConvertTwitchLiveChat(ctx context.Context, input dto.ArchiveVideoInput) err
return temporal.NewApplicationError(err.Error(), "", nil)
}

// loop through videos and find the one that matches vExtID
// attempt to find vod of current livestream
var previousVideoID string
for _, video := range videos {
if video.StreamID == input.Vod.ExtID {
previousVideoID = video.ID
}
}
// If no previous video ID was found, use the current video ID
// If no previous video ID was found, use a random id
if previousVideoID == "" {
cancel()
log.Warn().Msgf("Unable to convert chat due to no previous video IDs")
// TODO: exit gracefully
log.Warn().Msgf("Stream %s on channel %s has no previous video ID, using %s", input.VideoID, input.Channel.Name, previousVideoID)
previousVideoID = "132195945"
}

err = utils.ConvertTwitchLiveChatToVodChat(fmt.Sprintf("/tmp/%s_%s-live-chat.json", input.Vod.ExtID, input.Vod.ID), input.Channel.Name, input.Vod.ID.String(), input.Vod.ExtID, cID, input.Queue.ChatStart, string(previousVideoID))
Expand Down

0 comments on commit 1b4d525

Please sign in to comment.