I made it so that an error would be displayed if ffmpeg was not found.
This commit is contained in:
parent
1070b796cc
commit
10aa917c24
@ -53,8 +53,11 @@ func (s Service) RunConvert(setting ConvertSetting) error {
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
errStringArr := regexp.MustCompile("\r?\n").Split(strings.TrimSpace(string(out)), -1)
|
||||
if len(errStringArr) > 1 {
|
||||
return errors.New(errStringArr[len(errStringArr)-1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -64,7 +67,11 @@ func (s Service) GetTotalDuration(file *File) (duration float64, err error) {
|
||||
cmd := exec.Command(s.pathFFprobe, args...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return 0, errors.New(strings.TrimSpace(string(out)))
|
||||
errString := strings.TrimSpace(string(out))
|
||||
if len(errString) > 1 {
|
||||
return 0, errors.New(errString)
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
return strconv.ParseFloat(strings.TrimSpace(string(out)), 64)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user