mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2026-01-10 16:07:50 +00:00
parse timeStr function now returns milliseconds.
This commit is contained in:
parent
b0437b1656
commit
dca8bc5ffc
@ -23,7 +23,7 @@ type MediainputSetCursorCmd struct {
|
||||
|
||||
// Run executes the command to set the cursor position of the media input.
|
||||
func (cmd *MediainputSetCursorCmd) Run(ctx *context) error {
|
||||
position, err := parseTimeStringToSeconds(cmd.TimeString)
|
||||
position, err := parseTimeStringToMilliseconds(cmd.TimeString)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse time string: %w", err)
|
||||
}
|
||||
@ -36,7 +36,13 @@ func (cmd *MediainputSetCursorCmd) Run(ctx *context) error {
|
||||
return fmt.Errorf("failed to set media input cursor: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintln(ctx.Out, "Set media input cursor to position (seconds):", position)
|
||||
fmt.Fprintf(
|
||||
ctx.Out,
|
||||
"Set %s cursor to %s (%.0f ms)\n",
|
||||
ctx.Style.Highlight(cmd.InputName),
|
||||
ctx.Style.Highlight(cmd.TimeString),
|
||||
position,
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
||||
4
util.go
4
util.go
@ -39,7 +39,7 @@ func trimPrefix(s, prefix string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
func parseTimeStringToSeconds(timeStr string) (float64, error) {
|
||||
func parseTimeStringToMilliseconds(timeStr string) (float64, error) {
|
||||
parts := strings.Split(timeStr, ":")
|
||||
var durationStr string
|
||||
|
||||
@ -62,5 +62,5 @@ func parseTimeStringToSeconds(timeStr string) (float64, error) {
|
||||
return 0, fmt.Errorf("failed to parse duration: %w", err)
|
||||
}
|
||||
|
||||
return duration.Seconds(), nil
|
||||
return duration.Seconds() * 1000, nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user