Skip to content

Commit

Permalink
Re-add initializer to set mediainfo path
Browse files Browse the repository at this point in the history
Active encode still uses MediaInfo for the time being so we need to make
sure that variables are still being set up properly.

This commit also adds safe navigation or other conditionals to prevent
errors when MediaInfo or FFmpeg are not defined properly in
Settings.yml.
  • Loading branch information
masaball committed Aug 23, 2024
1 parent e5933c5 commit efe41de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/initializers/about_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
config.fedora = AboutPage::Fedora.new(ActiveFedora.fedora.connection)
config.solr = AboutPage::Solr.new(ActiveFedora.solr.conn, :numDocs => 1)
config.database = Avalon::About::Database.new(User)
config.mediainfo = Avalon::About::MediaInfo.new(path: Settings.mediainfo.path)
config.mediainfo = Settings&.mediainfo&.path ? Avalon::About::MediaInfo.new(path: Settings.mediainfo.path) : Avalon::About::MediaInfo.new()
config.streaming_server = Avalon::About::HLSServer.new(Settings.streaming.http_base)
config.sidekiq = Avalon::About::Sidekiq.new(numProcesses: 1)
config.redis = Avalon::About::Redis.new(Redis.new(Rails.application.config.cache_store[1]))
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/ac_mediainfo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set up for active_encode, need to happen before active_encode initializer
ENV["MEDIAINFO_PATH"] ||= Settings.mediainfo.path if Settings&.mediainfo&.path
4 changes: 2 additions & 2 deletions lib/tasks/avalon_tools.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

namespace :avalon do
namespace :tools do
ffmpeg_path = Settings.ffmpeg.path || "/usr/bin/ffmpeg"
mediainfo_path = Settings.mediainfo.path || "/usr/bin/mediainfo"
ffmpeg_path = Settings&.ffmpeg&.path || "/usr/bin/ffmpeg"
mediainfo_path = Settings&.mediainfo&.path || "/usr/bin/mediainfo"
DEFAULT_TOOLS = [
{ name: "ffmpeg", path: ffmpeg_path, version_params: "-version", version_string: ">= 4", version_trim_pre: "ffmpeg version ", version_trim_last_char: "-" },
{ name: "mediainfo", path: mediainfo_path, version_string: "> 18", version_line: 1, version_trim_pre: "MediaInfoLib - v" },
Expand Down

0 comments on commit efe41de

Please sign in to comment.