去除错误
This commit is contained in:
parent
104930c413
commit
f9256895b7
@ -461,12 +461,11 @@ func GetVideoDuration(ctx context.Context, filePath string) (float64, error) {
|
|||||||
span.SetStatus(codes.Error, "failed to get video duration")
|
span.SetStatus(codes.Error, "failed to get video duration")
|
||||||
return 0, fmt.Errorf("failed to get video duration: %w", err)
|
return 0, fmt.Errorf("failed to get video duration: %w", err)
|
||||||
}
|
}
|
||||||
span.SetAttributes(attribute.String("ffmpeg.stdout", out.String()))
|
span.SetAttributes(attribute.String("ffprobe.stdout", out.String()))
|
||||||
durationStr := strings.TrimSpace(out.String())
|
durationStr := strings.TrimSpace(out.String())
|
||||||
duration, err := strconv.ParseFloat(durationStr, 64)
|
duration, err := strconv.ParseFloat(durationStr, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
span.SetAttributes(attribute.String("error", err.Error()))
|
span.SetAttributes(attribute.String("error", err.Error()))
|
||||||
span.SetStatus(codes.Error, "failed to parse video duration")
|
|
||||||
return 0, fmt.Errorf("failed to parse video duration: %w", err)
|
return 0, fmt.Errorf("failed to parse video duration: %w", err)
|
||||||
}
|
}
|
||||||
span.SetAttributes(attribute.Float64("video.duration", duration))
|
span.SetAttributes(attribute.Float64("video.duration", duration))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user