- when resulting swf file is greater than 500K, use an image snapshot to generate the slide
- send out generating thumbnails progess update git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@2369 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
parent
3f412e1fc3
commit
4e733c1cba
@ -1,3 +0,0 @@
|
||||
#Created by grails
|
||||
eclipse.preferences.version=1
|
||||
groovy.dont.generate.class.files=true
|
@ -1,5 +1,3 @@
|
||||
|
||||
#Wed Apr 01 14:07:27 EDT 2009
|
||||
#Thu Sep 03 13:19:16 EDT 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.groovy
|
||||
|
@ -9,3 +9,6 @@
|
||||
mysql> create database bigbluebutton_prod;
|
||||
|
||||
mysql> grant all on bigbluebutton_dev.* to 'bbb'@'localhost' identified by 'secret';
|
||||
|
||||
|
||||
|
||||
|
@ -5,28 +5,40 @@ dataSource.url=jdbc:mysql://localhost/bigbluebutton_dev
|
||||
dataSource.username=bbb
|
||||
dataSource.password=secret
|
||||
|
||||
swfToolsDir=/bin
|
||||
imageMagickDir=/usr/bin
|
||||
# Directory where BigBlueButton stores uploaded slides
|
||||
presentationDir=/var/bigbluebutton
|
||||
ghostScriptExec=/usr/bin/gs
|
||||
BLANK_SLIDE = /var/bigbluebutton/blank/blank-slide.swf
|
||||
BLANK_THUMBNAIL = /var/bigbluebutton/blank/blank-thumb.png
|
||||
|
||||
beans.presentationService.swfToolsDir=${swfToolsDir}
|
||||
beans.presentationService.imageMagickDir=${imageMagickDir}
|
||||
beans.presentationService.presentationDir=${presentationDir}
|
||||
|
||||
# Directory where SWFTOOLS (pdf2swf, jpeg2swf, png2swf) are located
|
||||
swfToolsDir=/bin
|
||||
|
||||
# Directory where ImageMagick's convert executable is located
|
||||
imageMagickDir=/usr/bin
|
||||
|
||||
# Use fullpath to ghostscript executable since the exec names are different
|
||||
# for each platform.
|
||||
beans.presentationService.ghostScriptExec=${ghostScriptExec}
|
||||
|
||||
#
|
||||
# This URL needs to reference the host running the tomcat server
|
||||
bigbluebutton.web.serverURL=http://192.168.0.182
|
||||
ghostScriptExec=/usr/bin/gs
|
||||
|
||||
# This is a workaround for a problem converting PDF files, referenced at
|
||||
# http://groups.google.com/group/comp.lang.postscript/browse_thread/thread/c2e264ca76534ce0?pli=1
|
||||
noPdfMarkWorkaround=/etc/bigbluebutton/nopdfmark.ps
|
||||
|
||||
# These will be copied in cases where the conversion process
|
||||
# fails to generate a slide from the uploaded presentation
|
||||
BLANK_SLIDE = /var/bigbluebutton/blank/blank-slide.swf
|
||||
BLANK_THUMBNAIL = /var/bigbluebutton/blank/blank-thumb.png
|
||||
|
||||
# Inject the above properties into the PresentationService bean
|
||||
beans.presentationService.swfToolsDir=${swfToolsDir}
|
||||
beans.presentationService.imageMagickDir=${imageMagickDir}
|
||||
beans.presentationService.presentationDir=${presentationDir}
|
||||
beans.presentationService.ghostScriptExec=${ghostScriptExec}
|
||||
beans.presentationService.noPdfMarkWorkaround=${noPdfMarkWorkaround}
|
||||
beans.presentationService.BLANK_THUMBNAIL=${BLANK_THUMBNAIL}
|
||||
beans.presentationService.BLANK_SLIDE=${BLANK_SLIDE}
|
||||
|
||||
#
|
||||
# This URL is where the BBB client is accessible. When a user sucessfully
|
||||
# enters a name and password, she is redirected here to load the client.
|
||||
bigbluebutton.web.serverURL=http://192.168.0.182
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ class PresentationService {
|
||||
|
||||
int numPages = pageCounter.countNumberOfPages(presentationFile)
|
||||
log.info "There are $numPages pages in $presentationFile.absolutePath"
|
||||
convertUploadedPresentation(room, presentationName, presentationFile, numPages)
|
||||
convertUploadedPresentation(conf, room, presentationName, presentationFile, numPages)
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,39 +142,19 @@ class PresentationService {
|
||||
return new File(presentationDir + File.separatorChar + conf + File.separatorChar + room)
|
||||
}
|
||||
|
||||
public boolean convertUploadedPresentation(String room, String presentationName, File presentationFile, int numPages) {
|
||||
public boolean convertUploadedPresentation(String conference, String room, String presentationName, File presentationFile, int numPages) {
|
||||
log.debug "Converting uploaded presentation $presentationFile.absolutePath"
|
||||
for (int page = 1; page <= numPages; page++)
|
||||
{
|
||||
def msg = new HashMap()
|
||||
msg.put("room", room)
|
||||
msg.put("returnCode", "CONVERT")
|
||||
msg.put("presentationName", presentationName)
|
||||
msg.put("totalSlides", new Integer(numPages))
|
||||
msg.put("slidesCompleted", new Integer(page))
|
||||
sendJmsMessage(msg)
|
||||
|
||||
log.debug "Converting page $page of $presentationFile.absolutePath"
|
||||
|
||||
convertPage(presentationFile, page)
|
||||
{
|
||||
log.debug "Converting page $page of $presentationFile.absolutePath"
|
||||
convertPage(presentationFile, page)
|
||||
sendConversionUpdateMessage(conference, room, presentationName, numPages, page)
|
||||
}
|
||||
|
||||
log.debug "Creating thumbnails for $presentationFile.absolutePath"
|
||||
|
||||
ThumbnailCreatorImp tc = new ThumbnailCreatorImp()
|
||||
tc.imageMagickDir = imageMagickDir
|
||||
tc.blankThumbnail = BLANK_THUMBNAIL
|
||||
tc.createThumbnails(presentationFile, numPages)
|
||||
sendCreatingThumbnailsUpdateMessage(conference, room, presentationName)
|
||||
createPresentationThumbnails(presentationFile, numPages)
|
||||
|
||||
def msg = new HashMap()
|
||||
msg.put("room", room)
|
||||
msg.put("returnCode", "SUCCESS")
|
||||
msg.put("presentationName", presentationName)
|
||||
msg.put("message", "The presentation is now ready.")
|
||||
log.debug "Sending presentation conversion success for $presentationFile.absolutePath."
|
||||
sendJmsMessage(msg)
|
||||
log.debug "Send another success message...looks like bbb-apps at Red5 sometimes miss the message...need to investigate"
|
||||
sendJmsMessage(msg)
|
||||
sendConversionCompletedMessage(conference, room, presentationName, numPages)
|
||||
}
|
||||
|
||||
public boolean convertPage(File presentationFile, int page) {
|
||||
@ -241,6 +221,69 @@ class PresentationService {
|
||||
File slide = new File(dest);
|
||||
FileCopyUtils.copy(new File(BLANK_SLIDE), slide);
|
||||
}
|
||||
|
||||
private void createPresentationThumbnails(File presentation, int numberOfPages) {
|
||||
log.debug "Creating thumbnails for presentation.absolutePath"
|
||||
ThumbnailCreatorImp tc = new ThumbnailCreatorImp()
|
||||
tc.imageMagickDir = imageMagickDir
|
||||
tc.blankThumbnail = BLANK_THUMBNAIL
|
||||
tc.createThumbnails(presentation, numberOfPages)
|
||||
}
|
||||
|
||||
private void sendConversionUpdateMessage(String conference, String room, String presName, int totalSlides, int slidesCompleted) {
|
||||
def msg = new HashMap()
|
||||
msg.put("room", room)
|
||||
msg.put("returnCode", "CONVERT")
|
||||
msg.put("presentationName", presName)
|
||||
msg.put("totalSlides", new Integer(totalSlides))
|
||||
msg.put("slidesCompleted", new Integer(slidesCompleted))
|
||||
sendJmsMessage(msg)
|
||||
}
|
||||
|
||||
private void sendCreatingThumbnailsUpdateMessage(String conference, String room, String presName) {
|
||||
def msg = new HashMap()
|
||||
msg.put("room", room)
|
||||
msg.put("returnCode", "THUMBNAILS")
|
||||
msg.put("presentationName", presName)
|
||||
sendJmsMessage(msg)
|
||||
}
|
||||
|
||||
private void sendConversionCompletedMessage(String conference, String room, String presName, int numberOfPages) {
|
||||
|
||||
String xml = generateUploadedPresentationInfo(conference, room, presName, numberOfPages)
|
||||
|
||||
println xml
|
||||
|
||||
def msg = new HashMap()
|
||||
msg.put("room", room)
|
||||
msg.put("returnCode", "SUCCESS")
|
||||
msg.put("presentationName", presName)
|
||||
msg.put("message", xml)
|
||||
log.debug "Sending presentation conversion success for ${room} ${presName}."
|
||||
sendJmsMessage(msg)
|
||||
log.debug "Send another success message...looks like bbb-apps at Red5 sometimes miss the message...need to investigate"
|
||||
sendJmsMessage(msg)
|
||||
|
||||
}
|
||||
|
||||
private String generateUploadedPresentationInfo(String conf, String confRoom, String presName, int numberOfPages) {
|
||||
def writer = new java.io.StringWriter()
|
||||
def builder = new groovy.xml.MarkupBuilder(writer)
|
||||
|
||||
def uploadedpresentation = builder.uploadedpresentation {
|
||||
conference(id:conf, room:confRoom) {
|
||||
presentation(name:presName) {
|
||||
slides(count:numberOfPages) {
|
||||
for (def i = 1; i <= numberOfPages; i++) {
|
||||
slide(number:"${i}", name:"slide/${i}", thumb:"thumbnail/${i}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return writer.toString()
|
||||
}
|
||||
|
||||
private sendJmsMessage(HashMap message) {
|
||||
def msg = message.toString()
|
||||
|
@ -35,7 +35,7 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
|
||||
presService.jmsTemplate = new FakeJmsTemplate()
|
||||
}
|
||||
|
||||
/**
|
||||
void testGetUploadDirectory() {
|
||||
def uploadedFilename = 'sample-presentation.pdf'
|
||||
def uploadedFile = new File("test/resources/$uploadedFilename")
|
||||
@ -64,7 +64,7 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(rm, presName, uploadedPresentation, 21)
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 21)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 21, numPages
|
||||
@ -84,7 +84,7 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(rm, presName, uploadedPresentation, 1)
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 1)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 1, numPages
|
||||
@ -104,7 +104,7 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(rm, presName, uploadedPresentation, 5)
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 5)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 5, numPages
|
||||
@ -124,7 +124,7 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(rm, presName, uploadedPresentation, 2)
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 2)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 2, numPages
|
||||
@ -144,11 +144,54 @@ class PresentationServiceTests extends GroovyTestCase {
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(rm, presName, uploadedPresentation, 2)
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 2)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 2, numPages
|
||||
}
|
||||
|
||||
void testSecuredSlides() {
|
||||
def uploadedFilename = 'secure-slides.pdf'
|
||||
def uploadedFile = new File("test/resources/$uploadedFilename")
|
||||
def conf = "test-conf"
|
||||
def rm = "test-room"
|
||||
def presName = "secure-slides"
|
||||
|
||||
File uploadDir = presService.uploadedPresentationDirectory(conf, rm, presName)
|
||||
def uploadedPresentation = new File(uploadDir.absolutePath + File.separator + uploadedFilename)
|
||||
uploadedPresentation = new File("$PRESENTATIONDIR/$conf/$rm/$presName/$uploadedFilename")
|
||||
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 17)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 17, numPages
|
||||
}
|
||||
**/
|
||||
|
||||
void testSlideWithTooManyObject() {
|
||||
def uploadedFilename = 'SalesNetworks.pdf'
|
||||
def uploadedFile = new File("test/resources/$uploadedFilename")
|
||||
def conf = "test-conf"
|
||||
def rm = "test-room"
|
||||
def presName = "SalesNetworks"
|
||||
|
||||
File uploadDir = presService.uploadedPresentationDirectory(conf, rm, presName)
|
||||
def uploadedPresentation = new File(uploadDir.absolutePath + File.separator + uploadedFilename)
|
||||
uploadedPresentation = new File("$PRESENTATIONDIR/$conf/$rm/$presName/$uploadedFilename")
|
||||
|
||||
int copied = FileCopyUtils.copy(uploadedFile, uploadedPresentation)
|
||||
assertTrue(uploadedPresentation.exists())
|
||||
|
||||
presService.convertUploadedPresentation(conf, rm, presName, uploadedPresentation, 12)
|
||||
|
||||
int numPages = presService.numberOfThumbnails(conf, rm, presName)
|
||||
assertEquals 12, numPages
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*** Helper classes **/
|
||||
|
BIN
bigbluebutton-web/test/resources/SalesNetworks.pdf
Normal file
BIN
bigbluebutton-web/test/resources/SalesNetworks.pdf
Normal file
Binary file not shown.
BIN
bigbluebutton-web/test/resources/secure-slides.pdf
Normal file
BIN
bigbluebutton-web/test/resources/secure-slides.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user