From 4e3ec0f9b2b49ab70485628548e4d5d027cf6f27 Mon Sep 17 00:00:00 2001
From: Pedro Beschorner Marin <pedrobmarin@gmail.com>
Date: Thu, 6 Dec 2018 10:50:48 -0200
Subject: [PATCH] Fixes podcast undefined method xpath errors

---
 record-and-playback/podcast/scripts/process/podcast.rb | 2 +-
 record-and-playback/podcast/scripts/publish/podcast.rb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/record-and-playback/podcast/scripts/process/podcast.rb b/record-and-playback/podcast/scripts/process/podcast.rb
index 0c03377625..2519f381a8 100755
--- a/record-and-playback/podcast/scripts/process/podcast.rb
+++ b/record-and-playback/podcast/scripts/process/podcast.rb
@@ -114,7 +114,7 @@ if not FileTest.directory?(target_dir)
     end
 
     participants = recording.at_xpath("participants")
-    participants.content = BigBlueButton::Events.get_num_participants("#{raw_archive_dir}/events.xml")
+    participants.content = BigBlueButton::Events.get_num_participants(@doc)
 
     ## Remove empty meta
     metadata.search('//recording/meta').each do |meta|
diff --git a/record-and-playback/podcast/scripts/publish/podcast.rb b/record-and-playback/podcast/scripts/publish/podcast.rb
index 6ec3bcfcc1..e8f2b8b542 100755
--- a/record-and-playback/podcast/scripts/publish/podcast.rb
+++ b/record-and-playback/podcast/scripts/publish/podcast.rb
@@ -70,7 +70,8 @@ begin
       BigBlueButton.logger.info("copying: #{process_dir}/audio.ogg to -> #{target_dir}")
       FileUtils.cp("#{process_dir}/audio.ogg", target_dir)
 
-      recording_time = BigBlueButton::Events.get_recording_length("#{raw_archive_dir}/events.xml")
+      @doc = Nokogiri::XML(File.open("#{raw_archive_dir}/events.xml"))
+      recording_time = BigBlueButton::Events.get_recording_length(@doc)
 
       BigBlueButton.logger.info("Creating metadata.xml")
 
-- 
GitLab