mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Fix ffmpeg version detection
Fixes issue where ffmpeg version could not be detected if the version number had no patch number.
This commit is contained in:
@@ -109,7 +109,7 @@ func (f *FFMpeg) getVersion() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
version_re := regexp.MustCompile(`ffmpeg version ((\d+)\.(\d+)\.(\d+))`)
|
version_re := regexp.MustCompile(`ffmpeg version ((\d+)\.(\d+)(?:\.(\d+))?)`)
|
||||||
stdoutStr := stdout.String()
|
stdoutStr := stdout.String()
|
||||||
match := version_re.FindStringSubmatchIndex(stdoutStr)
|
match := version_re.FindStringSubmatchIndex(stdoutStr)
|
||||||
if match == nil {
|
if match == nil {
|
||||||
@@ -118,7 +118,13 @@ func (f *FFMpeg) getVersion() error {
|
|||||||
|
|
||||||
majorS := stdoutStr[match[4]:match[5]]
|
majorS := stdoutStr[match[4]:match[5]]
|
||||||
minorS := stdoutStr[match[6]:match[7]]
|
minorS := stdoutStr[match[6]:match[7]]
|
||||||
patchS := stdoutStr[match[8]:match[9]]
|
|
||||||
|
// patch is optional
|
||||||
|
var patchS string
|
||||||
|
if match[8] != -1 && match[9] != -1 {
|
||||||
|
patchS = stdoutStr[match[8]:match[9]]
|
||||||
|
}
|
||||||
|
|
||||||
if i, err := strconv.Atoi(majorS); err == nil {
|
if i, err := strconv.Atoi(majorS); err == nil {
|
||||||
f.version.major = i
|
f.version.major = i
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user