Skip to content

Commit

Permalink
fix: better funscript metadata handling (xbapps#1742)
Browse files Browse the repository at this point in the history
Co-authored-by: crwxaj <crwxaj>
  • Loading branch information
crwxaj authored Jun 4, 2024
1 parent 6a39b31 commit 20d001a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/tasks/heatmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// Script is the Funscript container type holding Launch data.
type Script struct {
// Version of Launchscript
Version string `json:"version"`
Version interface{} `json:"version"`
// Inverted causes up and down movement to be flipped.
Inverted bool `json:"inverted,omitempty"`
// Range is the percentage of a full stroke to use.
Expand Down Expand Up @@ -262,6 +262,11 @@ func (funscript Script) getDuration() float64 {

if funscript.Metadata != nil && float64(funscript.Metadata.Duration) > duration {
duration = float64(funscript.Metadata.Duration)

if duration > 50000 {
// large values are likely in milliseconds
duration = duration / 1000.0
}
}
return duration
}
Expand Down

0 comments on commit 20d001a

Please sign in to comment.