Add option to rap-process-worker to accept a filtering pattern

It will only process recordings which ID matches the pattern. By default
the pattern is nil and it will process all recordings.
This commit is contained in:
Leonardo Crauss Daronco 2019-12-04 12:05:18 -03:00
parent b1b49f8f8f
commit 9e5c386e6f

View File

@ -22,8 +22,9 @@ require '../lib/recordandplayback'
require 'rubygems'
require 'yaml'
require 'fileutils'
require 'optparse'
def process_archived_meetings(recording_dir)
def process_archived_meetings(recording_dir, pattern)
sanity_done_files = Dir.glob("#{recording_dir}/status/sanity/*.done")
FileUtils.mkdir_p("#{recording_dir}/status/processed")
@ -43,6 +44,12 @@ def process_archived_meetings(recording_dir)
next
end
unless pattern.nil?
next unless pattern.match(done_base)
BigBlueButton.logger.info("Processing #{done_base} because it matched the pattern #{pattern.inspect}")
end
step_succeeded = true
# Generate captions
@ -151,9 +158,18 @@ begin
logger.level = Logger::INFO
BigBlueButton.logger = logger
BigBlueButton.logger.debug("Running rap-process-worker...")
process_archived_meetings(recording_dir)
options = { pattern: nil }
OptionParser.new do |opt|
opt.on('-p PATTERN') { |o| options[:pattern] = o }
end.parse!
pattern = Regexp.new(options[:pattern]) unless options[:pattern].nil?
if pattern.nil?
BigBlueButton.logger.debug("Running rap-process-worker...")
else
BigBlueButton.logger.debug("Running rap-process-worker with pattern #{pattern.inspect}...")
end
process_archived_meetings(recording_dir, pattern)
BigBlueButton.logger.debug("rap-process-worker done")