lib/xmorph/base.rb in xmorph-0.1.3 vs lib/xmorph/base.rb in xmorph-0.1.4
- old
+ new
@@ -1,8 +1,8 @@
module XMorph
class Base
- require_relative 'util'
+
IGNORE = "ignore"
VALIDATE = "validate"
ALLOWED_ASPECT_RATIO = "allowed_aspect_ratio"
ALLOWED_HEIGHT = "allowed_height"
@@ -36,21 +36,20 @@
self.set_profiles
end
def self.get_transcode_template(host, domain, name, asset_path, return_loaded_filepath=false)
return nil unless domain
- file_path = File.join(self.root, "xmorph", host, domain, "transcode.rb")
+ file_path = File.join(self.root, "xmorph", "customers", host, domain, "transcode.rb")
raise TranscoderError.new("Transcoding profile doesn't exist for account, #{name}.") unless File.exist? file_path
XMorph::Base.logger.debug("XMorph#get_transcode_template: loading file #{file_path} to transcode #{asset_path}")
load file_path
return Transcode.new(asset_path), file_path if return_loaded_filepath
return Transcode.new(asset_path)
end
def get_asset_details
mediainfo_command = "#{File.dirname(self.class.root)}/bin/mediainfo --output=XML #{self.asset_path}"
- XMorph::Base.logger.debug("XMorph#get_asset_details: mediainfo_command: #{mediainfo_command}")
success, response = Util.run_cmd_with_response(mediainfo_command)
raise TranscoderError.new("Failed to get mediainfo for the asset.") unless success
begin
self.mediainfo_output = Util.mediainfo_xml_to_hash(response)[1]
rescue => e
@@ -82,11 +81,10 @@
def get_profile(return_profile_name=false)
self.set_profile_name
if (self.profile_name.blank? or self.profiles[self.profile_name].blank?)
raise TranscoderError.new(self.error || "Media doesnt match any transcoding profiles.")
end
- XMorph::Base.logger.debug("XMorph#get_profile: Command for #{self.asset_path}: #{self.profiles[self.profile_name]}")
return self.profile_name, self.profiles[self.profile_name] if return_profile_name
return self.profiles[self.profile_name]
end
def transcode(cmd)
@@ -185,16 +183,14 @@
end
end
unless missing.empty?
self.error = "Couldn't find #{missing.join(",")} of the Video correctly"
- XMorph::Base.logger.debug("XMorph#perform_default_video_validations: Failed, error: #{self.error}")
return false
end
unless errors.empty?
self.error = errors.join("\n")
- XMorph::Base.logger.debug("XMorph#perform_default_video_validations: Failed, error: #{self.error}")
return false
end
return true
end
@@ -250,15 +246,13 @@
end
end
end
unless missing.empty?
self.error = "Couldn't find #{missing.join(",")} of the Video correctly"
- XMorph::Base.logger.debug("XMorph#perform_default_audio_validations: #{self.error}")
return false
end
unless errors.empty?
self.error = errors.join("\n")
- XMorph::Base.logger.debug("XMorph#perform_default_audio_validations: #{self.error}")
return false
end
return true
end
end
\ No newline at end of file