Skip to content

Commit

Permalink
Do not process for Matterhorn if webcam, audio, or desktop are not av…
Browse files Browse the repository at this point in the history
…ailable to be processed.
  • Loading branch information
gugat committed May 4, 2012
1 parent 5ca7a51 commit df41ce8
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions record-and-playback/matterhorn/scripts/process/matterhorn.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,55 @@

meeting_id = opts[:meeting_id]

#Matterhorn process log file
logger = Logger.new("/var/log/bigbluebutton/matterhorn/process-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger

# This script lives in scripts/archive/steps while bigbluebutton.yml lives in scripts/
props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))

recording_dir = props['recording_dir']
raw_archive_dir = "#{recording_dir}/raw/#{meeting_id}"
target_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"

if not FileTest.directory?(target_dir)
raw_archive_dir = "#{recording_dir}/raw/#{meeting_id}"
FileUtils.mkdir_p target_dir

# Create a copy of the raw archives
temp_dir = "#{target_dir}/temp"
FileUtils.mkdir_p temp_dir
FileUtils.cp_r(raw_archive_dir, temp_dir)

# Process webcam recording
BigBlueButton.process_webcam(target_dir, temp_dir, meeting_id)

# Process desktop sharing
BigBlueButton.process_deskstop_sharing(target_dir, temp_dir, meeting_id)

BigBlueButton::MatterhornProcessor.create_manifest_xml("#{target_dir}/muxed-audio-webcam.flv", "#{target_dir}/deskshare.flv", "#{target_dir}/manifest.xml")

metadata = BigBlueButton::Events.get_meeting_metadata("#{temp_dir}/#{meeting_id}/events.xml")

BigBlueButton::MatterhornProcessor.create_dublincore_xml("#{target_dir}/dublincore.xml",
{:title => metadata[:title.to_s],
:subject => metadata[:subject.to_s],
:description => metadata[:description.to_s],
:creator => metadata[:creator.to_s],
:contributor => metadata[:contributor.to_s],
:language => metadata[:language.to_s],
:identifier => metadata[:identifier.to_s]})
process_done = File.new("#{recording_dir}/status/processed/#{meeting_id}-matterhorn.done", "w")
process_done.write("Processed #{meeting_id}")
process_done.close
#else
# BigBlueButton.logger.debug("Skipping #{meeting_id} as it has already been processed.")
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir

#Verify media absence before trying to process
media_absence = Hash.new
media_absence["audio"] = !Dir["#{raw_archive_dir}/audio/*"].empty?
media_absence["video"] = !Dir["#{raw_archive_dir}/video/*"].empty?
media_absence["deskshare"] = !Dir["#{raw_archive_dir}/deskshare/*"].empty?

if not media_absence.values.join("_").include? "false"
# Create a copy of the raw archives
temp_dir = "#{target_dir}/temp"
FileUtils.mkdir_p temp_dir
FileUtils.cp_r(raw_archive_dir, temp_dir)

# Process webcam recording
BigBlueButton.process_webcam(target_dir, temp_dir, meeting_id)

# Process desktop sharing
BigBlueButton.process_deskstop_sharing(target_dir, temp_dir, meeting_id)

#Create xml files with metadata
BigBlueButton::MatterhornProcessor.create_manifest_xml("#{target_dir}/muxed-audio-webcam.flv", "#{target_dir}/deskshare.flv", "#{target_dir}/manifest.xml")

metadata = BigBlueButton::Events.get_meeting_metadata("#{temp_dir}/#{meeting_id}/events.xml")

dublincore_data = { :title => metadata[:title.to_s],
:subject => metadata[:subject.to_s],
:description => metadata[:description.to_s],
:creator => metadata[:creator.to_s],
:contributor => metadata[:contributor.to_s],
:language => metadata[:language.to_s],
:identifier => metadata[:identifier.to_s]
}
BigBlueButton::MatterhornProcessor.create_dublincore_xml("#{target_dir}/dublincore.xml", dublincore_data)
else
logger.error "Failed Matterhorn process for meeting #{meeting_id}. Absence of media #{media_absence.to_s}"
end

end



0 comments on commit df41ce8

Please sign in to comment.