mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-08 08:44:27 +00:00
Adjust ffmpeg version detection in admin panel (#31130)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
dfd43869c9
commit
b120792f27
|
@ -98,7 +98,8 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
end
|
end
|
||||||
|
|
||||||
def ffmpeg_version
|
def ffmpeg_version
|
||||||
version = `ffmpeg -version`.match(/ffmpeg version ([\d\.]+)/)[1]
|
version_output = Terrapin::CommandLine.new(Rails.configuration.x.ffprobe_binary, '-show_program_version -v 0 -of json').run
|
||||||
|
version = Oj.load(version_output, mode: :strict, symbol_keys: true).dig(:program_version, :version)
|
||||||
|
|
||||||
{
|
{
|
||||||
key: 'ffmpeg',
|
key: 'ffmpeg',
|
||||||
|
@ -106,7 +107,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
value: version,
|
value: version,
|
||||||
human_value: version,
|
human_value: version,
|
||||||
}
|
}
|
||||||
rescue Errno::ENOENT
|
rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue