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,7 +53,10 @@ func (s Service) RunConvert(setting ConvertSetting) error {
|
|||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errStringArr := regexp.MustCompile("\r?\n").Split(strings.TrimSpace(string(out)), -1)
|
errStringArr := regexp.MustCompile("\r?\n").Split(strings.TrimSpace(string(out)), -1)
|
||||||
return errors.New(errStringArr[len(errStringArr)-1])
|
if len(errStringArr) > 1 {
|
||||||
|
return errors.New(errStringArr[len(errStringArr)-1])
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -64,7 +67,11 @@ func (s Service) GetTotalDuration(file *File) (duration float64, err error) {
|
|||||||
cmd := exec.Command(s.pathFFprobe, args...)
|
cmd := exec.Command(s.pathFFprobe, args...)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
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)
|
return strconv.ParseFloat(strings.TrimSpace(string(out)), 64)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user