Skip to content

Commit

Permalink
use reference videos for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
marnym committed Nov 11, 2023
1 parent 7007a16 commit e7c1b45
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions backend/pocketbase/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func inferAndScore(app *pocketbase.PocketBase, video *models.Record, fileName st
}
defer response.Body.Close()

// Read the response body
body, err := io.ReadAll(response.Body)
if err != nil {
log.Printf("Error reading response body %s: %v\n", video.Id, err)
Expand All @@ -69,10 +68,20 @@ func inferAndScore(app *pocketbase.PocketBase, video *models.Record, fileName st
}
log.Printf("saved infer for: %s", video.Id)

tier := video.Get("tier")

log.Printf("fetching reference video: %s", tier)
referenceVideo, err := app.Dao().FindFirstRecordByData("source_videos", "tier", tier)
if err != nil {
log.Printf("failed to fetch reference video %s: %v", tier, err)
}

referenceInfer := referenceVideo.Get("infer").(string)

log.Printf("calculating score for video: %s", video.Id)
reqBody, err := json.Marshal(Comparison{
Frames1: string(body),
Frames2: string(body),
Frames2: referenceInfer,
})
if err != nil {
log.Printf("comparison to json failed %s: %v\n", video.Id, err)
Expand Down

0 comments on commit e7c1b45

Please sign in to comment.