From 7be21e5e53a049f8006aca39398b950b7c80f68f Mon Sep 17 00:00:00 2001
From: Felipe Cecagno <fcecagno@gmail.com>
Date: Mon, 27 Aug 2012 16:23:12 -0300
Subject: [PATCH] only copies the slides text files if they exist; this is to
 keep the script compatible with old recordings

---
 .../presentation/scripts/process/presentation.rb              | 4 +++-
 record-and-playback/slides/scripts/process/slides.rb          | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/record-and-playback/presentation/scripts/process/presentation.rb b/record-and-playback/presentation/scripts/process/presentation.rb
index 088ba96fd6..9ac71437ae 100755
--- a/record-and-playback/presentation/scripts/process/presentation.rb
+++ b/record-and-playback/presentation/scripts/process/presentation.rb
@@ -79,7 +79,9 @@ if not FileTest.directory?(target_dir)
            #BigBlueButton::Presentation.convert_pdf_to_png(pdf_page, "#{target_pres_dir}/slide-#{page}.png")
            command = "convert -density 300x300 -resize 1600x1200 -quality 90 +dither -depth 8 -colors 256 #{pdf_page} #{target_pres_dir}/slide-#{page}.png"
            BigBlueButton.execute(command)
-           FileUtils.cp("#{pres_dir}/textfiles/slide-#{page}.txt", "#{target_pres_dir}/textfiles")
+           if File.exist?("#{pres_dir}/textfiles/slide-#{page}.txt") then
+             FileUtils.cp("#{pres_dir}/textfiles/slide-#{page}.txt", "#{target_pres_dir}/textfiles")
+           end
          end
     else
         ext = File.extname("#{images[0]}")
diff --git a/record-and-playback/slides/scripts/process/slides.rb b/record-and-playback/slides/scripts/process/slides.rb
index 4dfc3d356c..52f6c17aba 100755
--- a/record-and-playback/slides/scripts/process/slides.rb
+++ b/record-and-playback/slides/scripts/process/slides.rb
@@ -56,7 +56,9 @@ if not FileTest.directory?(target_dir)
            pdf_page = "#{pres_dir}/slide-#{page}.pdf"
            BigBlueButton::Presentation.extract_page_from_pdf(page, pres_pdf, pdf_page)
            BigBlueButton::Presentation.convert_pdf_to_png(pdf_page, "#{target_pres_dir}/slide-#{page}.png")
-           FileUtils.cp("#{pres_dir}/textfiles/slide-#{page}.txt", "#{target_pres_dir}/textfiles")
+           if File.exist?("#{pres_dir}/textfiles/slide-#{page}.txt") then
+             FileUtils.cp("#{pres_dir}/textfiles/slide-#{page}.txt", "#{target_pres_dir}/textfiles")
+           end
          end
     else
         ext = File.extname("#{images[0]}")
-- 
GitLab