Merge branch 'gthacoder-svg-conversion' into development
This commit is contained in:
commit
6fa29a4077
@ -50,7 +50,7 @@ libraryDependencies ++= {
|
||||
"com.google.code.gson" % "gson" % "1.7.1",
|
||||
"redis.clients" % "jedis" % "2.1.0",
|
||||
"org.apache.commons" % "commons-lang3" % "3.2",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.9"
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.10"
|
||||
)}
|
||||
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class GotoSlidePresentationRecordEvent extends
|
||||
eventMap.put("txtUri", txtUri);
|
||||
}
|
||||
|
||||
public void setPngUri(String pngUri) {
|
||||
eventMap.put("pngUri", pngUri);
|
||||
public void setSvgUri(String svgUri) {
|
||||
eventMap.put("svgUri", svgUri);
|
||||
}
|
||||
|
||||
public void setXOffset(double offset) {
|
||||
|
@ -50,8 +50,8 @@ public class ResizeAndMoveSlidePresentationRecordEvent extends
|
||||
eventMap.put("txtUri", txtUri);
|
||||
}
|
||||
|
||||
public void setPngUri(String pngUri) {
|
||||
eventMap.put("pngUri", pngUri);
|
||||
public void setSvgUri(String svgUri) {
|
||||
eventMap.put("svgUri", svgUri);
|
||||
}
|
||||
|
||||
public void setXOffset(double offset) {
|
||||
|
@ -234,10 +234,10 @@ class BigBlueButtonInGW(val system: ActorSystem, recorderApp: RecorderApplicatio
|
||||
val swfUri = presBaseUrl + "/slide/" + i
|
||||
|
||||
val txtUri = presBaseUrl + "/textfiles/" + i
|
||||
val pngUri = presBaseUrl + "/png/" + i
|
||||
val svgUri = presBaseUrl + "/svg/" + i
|
||||
|
||||
val p = new Page(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri,
|
||||
txtUri = txtUri, pngUri = pngUri,
|
||||
txtUri = txtUri, svgUri = svgUri,
|
||||
current = current)
|
||||
pages += (p.id -> p)
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class MessageSenderActor(val meetingId: String, val service: MessageSender)
|
||||
res += "thumb_uri" -> page.thumbUri
|
||||
res += "swf_uri" -> page.swfUri
|
||||
res += "txt_uri" -> page.txtUri
|
||||
res += "png_uri" -> page.pngUri
|
||||
res += "svg_uri" -> page.svgUri
|
||||
res += "current" -> page.current
|
||||
res += "x_offset" -> page.xOffset
|
||||
res += "y_offset" -> page.yOffset
|
||||
|
@ -111,7 +111,7 @@ class RecorderActor(val meetingId: String, val recorder: RecorderApplication)
|
||||
event.setThumbUri(msg.page.thumbUri);
|
||||
event.setSwfUri(msg.page.swfUri);
|
||||
event.setTxtUri(msg.page.txtUri);
|
||||
event.setPngUri(msg.page.pngUri);
|
||||
event.setSvgUri(msg.page.svgUri);
|
||||
event.setXOffset(msg.page.xOffset);
|
||||
event.setYOffset(msg.page.yOffset);
|
||||
event.setWidthRatio(msg.page.widthRatio);
|
||||
@ -130,7 +130,7 @@ class RecorderActor(val meetingId: String, val recorder: RecorderApplication)
|
||||
event.setThumbUri(msg.page.thumbUri);
|
||||
event.setSwfUri(msg.page.swfUri);
|
||||
event.setTxtUri(msg.page.txtUri);
|
||||
event.setPngUri(msg.page.pngUri);
|
||||
event.setSvgUri(msg.page.svgUri);
|
||||
event.setXOffset(msg.page.xOffset);
|
||||
event.setYOffset(msg.page.yOffset);
|
||||
event.setWidthRatio(msg.page.widthRatio);
|
||||
|
@ -10,7 +10,7 @@ case class Page(id: String, num: Int,
|
||||
thumbUri: String = "",
|
||||
swfUri: String,
|
||||
txtUri: String,
|
||||
pngUri: String,
|
||||
svgUri: String,
|
||||
current: Boolean = false,
|
||||
xOffset: Double = 0, yOffset: Double = 0,
|
||||
widthRatio: Double = 100D, heightRatio: Double = 100D)
|
||||
|
@ -14,7 +14,7 @@ object PesentationMessageToJsonConverter {
|
||||
res += "thumb_uri" -> page.thumbUri
|
||||
res += "swf_uri" -> page.swfUri
|
||||
res += "txt_uri" -> page.txtUri
|
||||
res += "png_uri" -> page.pngUri
|
||||
res += "svg_uri" -> page.svgUri
|
||||
res += "current" -> page.current
|
||||
res += "x_offset" -> page.xOffset
|
||||
res += "y_offset" -> page.yOffset
|
||||
|
@ -50,7 +50,7 @@ libraryDependencies ++= {
|
||||
"com.google.code.gson" % "gson" % "1.7.1",
|
||||
"redis.clients" % "jedis" % "2.1.0",
|
||||
"org.apache.commons" % "commons-lang3" % "3.2",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.9",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.10",
|
||||
"org.bigbluebutton" % "bbb-fsesl-client" % "0.0.2"
|
||||
)}
|
||||
|
||||
|
@ -4,7 +4,7 @@ name := "bbb-common-message"
|
||||
|
||||
organization := "org.bigbluebutton"
|
||||
|
||||
version := "0.0.9"
|
||||
version := "0.0.10"
|
||||
|
||||
// We want to have our jar files in lib_managed dir.
|
||||
// This way we'll have the right path when we import
|
||||
|
@ -47,7 +47,7 @@ public class GoToSlideReplyMessage {
|
||||
|
||||
if(pageObj.has(Constants.WIDTH_RATIO)
|
||||
&& pageObj.has(Constants.HEIGHT_RATIO)
|
||||
&& pageObj.has("png_uri")
|
||||
&& pageObj.has("svg_uri")
|
||||
&& pageObj.has("txt_uri")
|
||||
&& pageObj.has("num")
|
||||
&& pageObj.has(Constants.Y_OFFSET)
|
||||
@ -59,7 +59,7 @@ public class GoToSlideReplyMessage {
|
||||
) {
|
||||
int wRatio = pageObj.get(Constants.WIDTH_RATIO).getAsInt();
|
||||
int hRatio = pageObj.get(Constants.HEIGHT_RATIO).getAsInt();
|
||||
String pngUri = pageObj.get("png_uri").getAsString();
|
||||
String svgUri = pageObj.get("svg_uri").getAsString();
|
||||
String txtUri = pageObj.get("txt_uri").getAsString();
|
||||
int num = pageObj.get("num").getAsInt();
|
||||
int xOffset = pageObj.get(Constants.X_OFFSET).getAsInt();
|
||||
@ -71,7 +71,7 @@ public class GoToSlideReplyMessage {
|
||||
|
||||
page.put(Constants.WIDTH_RATIO, wRatio);
|
||||
page.put(Constants.HEIGHT_RATIO, hRatio);
|
||||
page.put("png_uri", pngUri);
|
||||
page.put("svg_uri", svgUri);
|
||||
page.put("txt_uri", txtUri);
|
||||
page.put("num", num);
|
||||
page.put(Constants.X_OFFSET, xOffset);
|
||||
|
@ -328,7 +328,7 @@ public class Util {
|
||||
JsonObject pageObj = (JsonObject)pagesIter.next();
|
||||
if (pageObj.has("id") && pageObj.has("num")
|
||||
&& pageObj.has("thumb_uri") && pageObj.has("swf_uri")
|
||||
&& pageObj.has("txt_uri") && pageObj.has("png_uri")
|
||||
&& pageObj.has("txt_uri") && pageObj.has("svg_uri")
|
||||
&& pageObj.has("current") && pageObj.has("x_offset")
|
||||
&& pageObj.has("y_offset") && pageObj.has("width_ratio")
|
||||
&& pageObj.has("height_ratio")) {
|
||||
@ -340,7 +340,7 @@ public class Util {
|
||||
String pageThumbUri = pageObj.get("thumb_uri").getAsString();
|
||||
String pageSwfUri = pageObj.get("swf_uri").getAsString();
|
||||
String pageTxtUri = pageObj.get("txt_uri").getAsString();
|
||||
String pagePngUri = pageObj.get("png_uri").getAsString();
|
||||
String pageSvgUri = pageObj.get("svg_uri").getAsString();
|
||||
|
||||
Boolean currentPage = pageObj.get("current").getAsBoolean();
|
||||
Double xOffset = pageObj.get("x_offset").getAsDouble();
|
||||
@ -353,7 +353,7 @@ public class Util {
|
||||
page.put("thumbUri", pageThumbUri);
|
||||
page.put("swfUri", pageSwfUri);
|
||||
page.put("txtUri", pageTxtUri);
|
||||
page.put("pngUri", pagePngUri);
|
||||
page.put("svgUri", pageSvgUri);
|
||||
page.put("current", currentPage);
|
||||
page.put("xOffset", xOffset);
|
||||
page.put("yOffset", yOffset);
|
||||
@ -527,7 +527,7 @@ public class Util {
|
||||
final String NUM = "num";
|
||||
final String HEIGHT_RATIO = "height_ratio";
|
||||
final String X_OFFSET = "x_offset";
|
||||
final String PNG_URI = "png_uri";
|
||||
final String SVG_URI = "svg_uri";
|
||||
final String THUMB_URI = "thumb_uri";
|
||||
final String TXT_URI = "txt_uri";
|
||||
final String CURRENT = "current";
|
||||
@ -539,7 +539,7 @@ public class Util {
|
||||
&& page.has(NUM)
|
||||
&& page.has(HEIGHT_RATIO)
|
||||
&& page.has(X_OFFSET)
|
||||
&& page.has(PNG_URI)
|
||||
&& page.has(SVG_URI)
|
||||
&& page.has(THUMB_URI)
|
||||
&& page.has(CURRENT)
|
||||
&& page.has(TXT_URI)
|
||||
@ -553,7 +553,7 @@ public class Util {
|
||||
double num = page.get(NUM).getAsDouble();
|
||||
double heightRatio = page.get(HEIGHT_RATIO).getAsDouble();
|
||||
double xOffset = page.get(X_OFFSET).getAsDouble();
|
||||
String pngUri = page.get(PNG_URI).getAsString();
|
||||
String svgUri = page.get(SVG_URI).getAsString();
|
||||
String thumbUri = page.get(THUMB_URI).getAsString();
|
||||
boolean current = page.get(CURRENT).getAsBoolean();
|
||||
String txtUri = page.get(TXT_URI).getAsString();
|
||||
@ -565,7 +565,7 @@ public class Util {
|
||||
finalPage.put(NUM, num);
|
||||
finalPage.put(HEIGHT_RATIO, heightRatio);
|
||||
finalPage.put(X_OFFSET, xOffset);
|
||||
finalPage.put(PNG_URI, pngUri);
|
||||
finalPage.put(SVG_URI, svgUri);
|
||||
finalPage.put(THUMB_URI, thumbUri);
|
||||
finalPage.put(CURRENT, current);
|
||||
finalPage.put(TXT_URI, txtUri);
|
||||
|
@ -112,7 +112,7 @@ dependencies {
|
||||
compile 'com.google.code.gson:gson:1.7.1'
|
||||
providedCompile 'org.apache.commons:commons-lang3:3.2'
|
||||
|
||||
compile 'org.bigbluebutton:bbb-common-message:0.0.9'
|
||||
compile 'org.bigbluebutton:bbb-common-message:0.0.10'
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -72,7 +72,7 @@ public class PresentationClientMessageSender {
|
||||
break;
|
||||
case PresentationSharedMessage.PRESENTATION_SHARED_MESSAGE:
|
||||
processPresentationSharedMessage(message);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class PresentationClientMessageSender {
|
||||
args.put("current", msg.page.get("current"));
|
||||
args.put("swfUri", msg.page.get("swf_uri"));
|
||||
args.put("txtUri", msg.page.get("txt_uri"));
|
||||
args.put("pngUri", msg.page.get("png_uri"));
|
||||
args.put("svgUri", msg.page.get("svg_uri"));
|
||||
args.put("thumbUri", msg.page.get("thumb_uri"));
|
||||
args.put("xOffset", msg.page.get("x_offset"));
|
||||
args.put("yOffset", msg.page.get("y_offset"));
|
||||
@ -301,7 +301,7 @@ public class PresentationClientMessageSender {
|
||||
args.put("xOffset", msg.page.get(Constants.X_OFFSET));
|
||||
args.put("num", msg.page.get("num"));
|
||||
args.put("heightRatio", msg.page.get(Constants.HEIGHT_RATIO));
|
||||
args.put("pngUri", msg.page.get("png_uri"));
|
||||
args.put("svgUri", msg.page.get("svg_uri"));
|
||||
args.put("thumbUri", msg.page.get("thumb_uri"));
|
||||
args.put(Constants.CURRENT, msg.page.get(Constants.CURRENT));
|
||||
args.put("txtUri", msg.page.get("txt_uri"));
|
||||
@ -317,6 +317,6 @@ public class PresentationClientMessageSender {
|
||||
BroadcastClientMessage m = new BroadcastClientMessage(msg.meetingId, "goToSlideCallback", message);
|
||||
service.sendMessage(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ Template.slide.rendered = ->
|
||||
if !$('.panel-footer').hasClass('ui-resizable-resizing') # not in the middle of resizing the message input
|
||||
redrawWhiteboard()
|
||||
)
|
||||
if currentSlide?.slide?.png_uri?
|
||||
if currentSlide?.slide?.svg_uri?
|
||||
createWhiteboardPaper (wpm) ->
|
||||
displaySlide wpm
|
||||
Tracker.autorun (comp) -> # whiteboard is redrawn every time user becomes a presenter or loses that status
|
||||
if BBB.isUserPresenter(getInSession('userId')) isnt undefined
|
||||
redrawWhiteboard()
|
||||
pic.src = currentSlide?.slide?.png_uri
|
||||
pic.src = currentSlide?.slide?.svg_uri
|
||||
|
||||
@createWhiteboardPaper = (callback) =>
|
||||
@whiteboardPaperModel = new Meteor.WhiteboardPaperModel('whiteboard-paper')
|
||||
@ -25,7 +25,7 @@ Template.slide.rendered = ->
|
||||
currentSlide = getCurrentSlideDoc()
|
||||
wpm.create()
|
||||
adjustedDimensions = scaleSlide(getInSession('slideOriginalWidth'), getInSession('slideOriginalHeight'))
|
||||
wpm._displayPage(currentSlide?.slide?.png_uri, getInSession('slideOriginalWidth'), getInSession('slideOriginalHeight'))
|
||||
wpm._displayPage(currentSlide?.slide?.svg_uri, getInSession('slideOriginalWidth'), getInSession('slideOriginalHeight'))
|
||||
manuallyDisplayShapes()
|
||||
wpm.scale(adjustedDimensions.width, adjustedDimensions.height)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
num: slideObject.num
|
||||
x_offset: slideObject.x_offset
|
||||
current: slideObject.current
|
||||
png_uri: slideObject.png_uri
|
||||
svg_uri: slideObject.svg_uri
|
||||
txt_uri: slideObject.txt_uri
|
||||
id: slideObject.id
|
||||
width_ratio: slideObject.width_ratio
|
||||
|
@ -25,12 +25,12 @@ class UrlMappings {
|
||||
action = [GET:'showThumbnail']
|
||||
}
|
||||
|
||||
"/presentation/$conference/$room/$presentation_name/pngs"(controller:"presentation") {
|
||||
action = [GET:'numberOfPngs']
|
||||
"/presentation/$conference/$room/$presentation_name/svgs"(controller:"presentation") {
|
||||
action = [GET:'numberOfSvgs']
|
||||
}
|
||||
|
||||
"/presentation/$conference/$room/$presentation_name/png/$id"(controller:"presentation") {
|
||||
action = [GET:'showPngImage']
|
||||
"/presentation/$conference/$room/$presentation_name/svg/$id"(controller:"presentation") {
|
||||
action = [GET:'showSvgImage']
|
||||
}
|
||||
|
||||
"/presentation/$conference/$room/$presentation_name/textfiles"(controller:"presentation") {
|
||||
|
@ -69,9 +69,9 @@ maxNumPages=200
|
||||
MAX_SWF_FILE_SIZE=500000
|
||||
|
||||
#----------------------------------------------------
|
||||
# Additional conversion of the presentation slides to PNG
|
||||
# Additional conversion of the presentation slides to SVG
|
||||
# to be used in the HTML5 client
|
||||
pngImagesRequired=false
|
||||
svgImagesRequired=false
|
||||
|
||||
# Default number of digits for voice conference users joining through the PSTN.
|
||||
defaultNumDigitsForTelVoice=5
|
||||
@ -125,7 +125,7 @@ allowStartStopRecording=true
|
||||
#----------------------------------------------------
|
||||
# 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.23.3
|
||||
bigbluebutton.web.serverURL=http://192.168.23.44
|
||||
|
||||
|
||||
#----------------------------------------------------
|
||||
@ -149,7 +149,7 @@ defaultConfigURL=${bigbluebutton.web.serverURL}/client/conf/config.xml
|
||||
apiVersion=0.9
|
||||
|
||||
# Salt which is used by 3rd-party apps to authenticate api calls
|
||||
securitySalt=778818ef77e83a9b1cab2fd7c908e975
|
||||
securitySalt=a820d30da2db356124fce5bd5d8054b4
|
||||
|
||||
# Directory where we drop the <meeting-id-recorded>.done file
|
||||
recordStatusDir=/var/bigbluebutton/recording/status/recorded
|
||||
|
@ -79,7 +79,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="imageMagickDir" value="${imageMagickDir}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="pngImageCreator" class="org.bigbluebutton.presentation.imp.PngImageCreatorImp">
|
||||
<bean id="svgImageCreator" class="org.bigbluebutton.presentation.imp.SvgImageCreatorImp">
|
||||
<property name="imageMagickDir" value="${imageMagickDir}"/>
|
||||
</bean>
|
||||
|
||||
@ -91,18 +91,18 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="pdfPageToImageConversionService" ref="imageConvSvc"/>
|
||||
<property name="thumbnailCreator" ref="thumbCreator"/>
|
||||
<property name="textFileCreator" ref="textFileCreator"/>
|
||||
<property name="pngImageCreator" ref="pngImageCreator"/>
|
||||
<property name="svgImageCreator" ref="svgImageCreator"/>
|
||||
<property name="blankSlide" value="${BLANK_SLIDE}"/>
|
||||
<property name="maxSwfFileSize" value="${MAX_SWF_FILE_SIZE}"/>
|
||||
<property name="maxConversionTime" value="${maxConversionTime}"/>
|
||||
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
|
||||
<property name="pngImagesRequired" value="${pngImagesRequired}"/>
|
||||
<property name="svgImagesRequired" value="${svgImagesRequired}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="imageToSwfSlidesGenerationService" class="org.bigbluebutton.presentation.imp.ImageToSwfSlidesGenerationService">
|
||||
<property name="pngPageConverter" ref="png2SwfConverter"/>
|
||||
<property name="jpgPageConverter" ref="jpg2SwfConverter"/>
|
||||
<property name="pngImageCreator" ref="pngImageCreator"/>
|
||||
<property name="svgImageCreator" ref="svgImageCreator"/>
|
||||
<property name="thumbnailCreator" ref="thumbCreator"/>
|
||||
<property name="textFileCreator" ref="textFileCreator"/>
|
||||
<property name="blankSlide" value="${BLANK_SLIDE}"/>
|
||||
@ -114,4 +114,4 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="messagingService" ref="messagingService"/>
|
||||
<property name="generatedSlidesInfoHelper" ref="generatedSlidesInfoHelper"/>
|
||||
</bean>
|
||||
</beans>
|
||||
</beans>
|
||||
|
16
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy
Normal file → Executable file
16
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy
Normal file → Executable file
@ -144,7 +144,7 @@ class PresentationController {
|
||||
return null;
|
||||
}
|
||||
|
||||
def showPngImage = {
|
||||
def showSvgImage = {
|
||||
def presentationName = params.presentation_name
|
||||
def conf = params.conference
|
||||
def rm = params.room
|
||||
@ -153,11 +153,11 @@ class PresentationController {
|
||||
InputStream is = null;
|
||||
try {
|
||||
// def f = confInfo()
|
||||
def pres = presentationService.showPngImage(conf, rm, presentationName, slide)
|
||||
def pres = presentationService.showSvgImage(conf, rm, presentationName, slide)
|
||||
if (pres.exists()) {
|
||||
def bytes = pres.readBytes()
|
||||
response.addHeader("Cache-Control", "no-cache")
|
||||
response.contentType = 'image/png'
|
||||
response.contentType = 'image/svg+xml'
|
||||
response.outputStream << bytes;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -308,18 +308,18 @@ class PresentationController {
|
||||
}
|
||||
}
|
||||
|
||||
def numberOfPngs = {
|
||||
def numberOfSvgs = {
|
||||
def filename = params.presentation_name
|
||||
def f = confInfo()
|
||||
def numPngs = presentationService.numberOfPngs(f.conference, f.room, filename)
|
||||
def numSvgs = presentationService.numberOfSvgs(f.conference, f.room, filename)
|
||||
withFormat {
|
||||
xml {
|
||||
render(contentType:"text/xml") {
|
||||
conference(id:f.conference, room:f.room) {
|
||||
presentation(name:filename) {
|
||||
pngs(count:numPngs) {
|
||||
for (def i=0;i<numPngs;i++) {
|
||||
png(name:"pngs/${i}")
|
||||
svgs(count:numSvgs) {
|
||||
for (def i=0;i<numSvgs;i++) {
|
||||
svg(name:"svgs/${i}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy
Normal file → Executable file
14
bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy
Normal file → Executable file
@ -94,8 +94,8 @@ class PresentationService {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "slide-${id}.swf")
|
||||
}
|
||||
|
||||
def showPngImage(String conf, String room, String presentationName, String id) {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "pngs" + File.separatorChar + "slide${id}.png")
|
||||
def showSvgImage(String conf, String room, String presentationName, String id) {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "svgs" + File.separatorChar + "slide${id}.svg")
|
||||
}
|
||||
|
||||
def showPresentation = {conf, room, filename ->
|
||||
@ -125,9 +125,9 @@ class PresentationService {
|
||||
thumbDir.listFiles().length
|
||||
}
|
||||
|
||||
def numberOfPngs = {conf, room, name ->
|
||||
def PngsDir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "pngs")
|
||||
PngsDir.listFiles().length
|
||||
def numberOfSvgs = {conf, room, name ->
|
||||
def SvgsDir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "svgs")
|
||||
SvgsDir.listFiles().length
|
||||
}
|
||||
|
||||
def numberOfTextfiles = {conf, room, name ->
|
||||
@ -166,8 +166,8 @@ class PresentationService {
|
||||
/*** Helper classes **/
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.File;
|
||||
class PngFilter implements FilenameFilter {
|
||||
class SvgFilter implements FilenameFilter {
|
||||
public boolean accept(File dir, String name) {
|
||||
return (name.endsWith(".png"));
|
||||
return (name.endsWith(".svg"));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class ConversionMessageConstants {
|
||||
public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL";
|
||||
public static final String GENERATING_TEXTFILES_KEY = "GENERATING_TEXTFILES";
|
||||
public static final String GENERATED_TEXTFILES_KEY = "GENERATED_TEXTFILES";
|
||||
public static final String GENERATING_PNGIMAGES_KEY = "GENERATING_PNGIMAGES";
|
||||
public static final String GENERATED_PNGIMAGES_KEY = "GENERATED_PNGIMAGES";
|
||||
public static final String GENERATING_SVGIMAGES_KEY = "GENERATING_SVGIMAGES";
|
||||
public static final String GENERATED_SVGIMAGES_KEY = "GENERATED_SVGIMAGES";
|
||||
public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED";
|
||||
}
|
||||
|
@ -22,6 +22,6 @@
|
||||
*/
|
||||
package org.bigbluebutton.presentation;
|
||||
|
||||
public interface PngImageCreator {
|
||||
public boolean createPngImages(UploadedPresentation pres);
|
||||
public interface SvgImageCreator {
|
||||
public boolean createSvgImages(UploadedPresentation pres);
|
||||
}
|
18
bigbluebutton-web/src/java/org/bigbluebutton/presentation/imp/ImageToSwfSlidesGenerationService.java
Normal file → Executable file
18
bigbluebutton-web/src/java/org/bigbluebutton/presentation/imp/ImageToSwfSlidesGenerationService.java
Normal file → Executable file
@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import org.bigbluebutton.presentation.PageConverter;
|
||||
import org.bigbluebutton.presentation.ImageToSwfSlide;
|
||||
import org.bigbluebutton.presentation.PngImageCreator;
|
||||
import org.bigbluebutton.presentation.SvgImageCreator;
|
||||
import org.bigbluebutton.presentation.TextFileCreator;
|
||||
import org.bigbluebutton.presentation.ThumbnailCreator;
|
||||
import org.bigbluebutton.presentation.UploadedPresentation;
|
||||
@ -45,7 +45,7 @@ public class ImageToSwfSlidesGenerationService {
|
||||
private SwfSlidesGenerationProgressNotifier notifier;
|
||||
private PageConverter jpgToSwfConverter;
|
||||
private PageConverter pngToSwfConverter;
|
||||
private PngImageCreator pngImageCreator;
|
||||
private SvgImageCreator svgImageCreator;
|
||||
private ThumbnailCreator thumbnailCreator;
|
||||
private TextFileCreator textFileCreator;
|
||||
private long MAX_CONVERSION_TIME = 5*60*1000;
|
||||
@ -69,7 +69,7 @@ public class ImageToSwfSlidesGenerationService {
|
||||
/* adding accessibility */
|
||||
createTextFiles(pres);
|
||||
createThumbnails(pres);
|
||||
createPngImages(pres);
|
||||
createSvgImages(pres);
|
||||
|
||||
notifier.sendConversionCompletedMessage(pres);
|
||||
}
|
||||
@ -95,10 +95,10 @@ public class ImageToSwfSlidesGenerationService {
|
||||
thumbnailCreator.createThumbnails(pres);
|
||||
}
|
||||
|
||||
private void createPngImages(UploadedPresentation pres) {
|
||||
log.debug("Creating PNG images.");
|
||||
notifier.sendCreatingPngImagesUpdateMessage(pres);
|
||||
pngImageCreator.createPngImages(pres);
|
||||
private void createSvgImages(UploadedPresentation pres) {
|
||||
log.debug("Creating SVG images.");
|
||||
notifier.sendCreatingSvgImagesUpdateMessage(pres);
|
||||
svgImageCreator.createSvgImages(pres);
|
||||
}
|
||||
|
||||
private void convertImageToSwf(UploadedPresentation pres, PageConverter pageConverter) {
|
||||
@ -184,8 +184,8 @@ public class ImageToSwfSlidesGenerationService {
|
||||
this.textFileCreator = textFileCreator;
|
||||
}
|
||||
|
||||
public void setPngImageCreator(PngImageCreator pngImageCreator) {
|
||||
this.pngImageCreator = pngImageCreator;
|
||||
public void setSvgImageCreator(SvgImageCreator svgImageCreator) {
|
||||
this.svgImageCreator = svgImageCreator;
|
||||
}
|
||||
|
||||
public void setMaxConversionTime(int minutes) {
|
||||
|
@ -41,7 +41,7 @@ public class PdfPageToImageConversionService {
|
||||
log.debug("Creating temporary pdf " + tempPdfFile.getAbsolutePath());
|
||||
|
||||
if (extractor.extractPage(presentationFile, tempPdfFile, page)) {
|
||||
File tempPngFile = new File(tempDir.getAbsolutePath() + "/temp-" + page + ".png");
|
||||
File tempPngFile = new File(tempDir.getAbsolutePath() + "/temp-" + page + ".svg");
|
||||
log.debug("Creating PNG " + tempPngFile.getAbsolutePath());
|
||||
|
||||
if (pdfToImageConverter.convert(tempPdfFile, tempPngFile, 1)) {
|
||||
|
28
bigbluebutton-web/src/java/org/bigbluebutton/presentation/imp/PdfToSwfSlidesGenerationService.java
Normal file → Executable file
28
bigbluebutton-web/src/java/org/bigbluebutton/presentation/imp/PdfToSwfSlidesGenerationService.java
Normal file → Executable file
@ -35,7 +35,7 @@ import org.bigbluebutton.presentation.ConversionMessageConstants;
|
||||
import org.bigbluebutton.presentation.ConversionUpdateMessage;
|
||||
import org.bigbluebutton.presentation.PageConverter;
|
||||
import org.bigbluebutton.presentation.PdfToSwfSlide;
|
||||
import org.bigbluebutton.presentation.PngImageCreator;
|
||||
import org.bigbluebutton.presentation.SvgImageCreator;
|
||||
import org.bigbluebutton.presentation.TextFileCreator;
|
||||
import org.bigbluebutton.presentation.ThumbnailCreator;
|
||||
import org.bigbluebutton.presentation.UploadedPresentation;
|
||||
@ -55,11 +55,11 @@ public class PdfToSwfSlidesGenerationService {
|
||||
|
||||
private ThumbnailCreator thumbnailCreator;
|
||||
private TextFileCreator textFileCreator;
|
||||
private PngImageCreator pngImageCreator;
|
||||
private SvgImageCreator svgImageCreator;
|
||||
private long MAX_CONVERSION_TIME = 5*60*1000;
|
||||
private String BLANK_SLIDE;
|
||||
private int MAX_SWF_FILE_SIZE;
|
||||
private boolean pngImagesRequired;
|
||||
private boolean svgImagesRequired;
|
||||
|
||||
public void generateSlides(UploadedPresentation pres) {
|
||||
log.debug("Generating slides");
|
||||
@ -70,9 +70,9 @@ public class PdfToSwfSlidesGenerationService {
|
||||
createTextFiles(pres);
|
||||
createThumbnails(pres);
|
||||
|
||||
// only create PNG images if the configuration requires it
|
||||
if (pngImagesRequired) {
|
||||
createPngImages(pres);
|
||||
// only create SVG images if the configuration requires it
|
||||
if (svgImagesRequired) {
|
||||
createSvgImages(pres);
|
||||
}
|
||||
|
||||
notifier.sendConversionCompletedMessage(pres);
|
||||
@ -114,10 +114,10 @@ public class PdfToSwfSlidesGenerationService {
|
||||
textFileCreator.createTextFiles(pres);
|
||||
}
|
||||
|
||||
private void createPngImages(UploadedPresentation pres) {
|
||||
log.info("Creating PNG images. MeetingId=[" + pres.getMeetingId() + "], presId=[" + pres.getId() + "], name=[" + pres.getName() + "]");
|
||||
notifier.sendCreatingPngImagesUpdateMessage(pres);
|
||||
pngImageCreator.createPngImages(pres);
|
||||
private void createSvgImages(UploadedPresentation pres) {
|
||||
log.info("Creating SVG images. MeetingId=[" + pres.getMeetingId() + "], presId=[" + pres.getId() + "], name=[" + pres.getName() + "]");
|
||||
notifier.sendCreatingSvgImagesUpdateMessage(pres);
|
||||
svgImageCreator.createSvgImages(pres);
|
||||
}
|
||||
|
||||
private void convertPdfToSwf(UploadedPresentation pres) {
|
||||
@ -214,8 +214,8 @@ public class PdfToSwfSlidesGenerationService {
|
||||
this.MAX_SWF_FILE_SIZE = size;
|
||||
}
|
||||
|
||||
public void setPngImagesRequired(boolean png) {
|
||||
this.pngImagesRequired = png;
|
||||
public void setSvgImagesRequired(boolean svg) {
|
||||
this.svgImagesRequired = svg;
|
||||
}
|
||||
|
||||
public void setThumbnailCreator(ThumbnailCreator thumbnailCreator) {
|
||||
@ -224,8 +224,8 @@ public class PdfToSwfSlidesGenerationService {
|
||||
public void setTextFileCreator(TextFileCreator textFileCreator) {
|
||||
this.textFileCreator = textFileCreator;
|
||||
}
|
||||
public void setPngImageCreator(PngImageCreator pngImageCreator) {
|
||||
this.pngImageCreator = pngImageCreator;
|
||||
public void setSvgImageCreator(SvgImageCreator svgImageCreator) {
|
||||
this.svgImageCreator = svgImageCreator;
|
||||
}
|
||||
public void setMaxConversionTime(int minutes) {
|
||||
MAX_CONVERSION_TIME = minutes * 60 * 1000;
|
||||
|
@ -6,21 +6,21 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.bigbluebutton.presentation.PngImageCreator;
|
||||
import org.bigbluebutton.presentation.SvgImageCreator;
|
||||
import org.bigbluebutton.presentation.SupportedFileTypes;
|
||||
import org.bigbluebutton.presentation.UploadedPresentation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PngImageCreatorImp implements PngImageCreator {
|
||||
private static Logger log = LoggerFactory.getLogger(PngImageCreatorImp.class);
|
||||
public class SvgImageCreatorImp implements SvgImageCreator {
|
||||
private static Logger log = LoggerFactory.getLogger(SvgImageCreatorImp.class);
|
||||
|
||||
private String IMAGEMAGICK_DIR;
|
||||
|
||||
@Override
|
||||
public boolean createPngImages(UploadedPresentation pres) {
|
||||
public boolean createSvgImages(UploadedPresentation pres) {
|
||||
boolean success = false;
|
||||
File imagePresentationDir = determinePngImagesDirectory(pres.getUploadedFile());
|
||||
File imagePresentationDir = determineSvgImagesDirectory(pres.getUploadedFile());
|
||||
if (! imagePresentationDir.exists())
|
||||
imagePresentationDir.mkdir();
|
||||
|
||||
@ -28,7 +28,7 @@ public class PngImageCreatorImp implements PngImageCreator {
|
||||
|
||||
try {
|
||||
extractPdfPages(pres);
|
||||
success = generatePngImages(imagePresentationDir,pres);
|
||||
success = generateSvgImages(imagePresentationDir,pres);
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Interrupted Exception while generating images.");
|
||||
success = false;
|
||||
@ -38,7 +38,7 @@ public class PngImageCreatorImp implements PngImageCreator {
|
||||
}
|
||||
|
||||
private void extractPdfPages(UploadedPresentation pres){
|
||||
File tmpDir = new File(pres.getUploadedFile().getParent() + File.separatorChar + "pngs" + File.separatorChar + "tmp");
|
||||
File tmpDir = new File(pres.getUploadedFile().getParent() + File.separatorChar + "svgs" + File.separatorChar + "tmp");
|
||||
if (! tmpDir.exists())
|
||||
tmpDir.mkdir();
|
||||
|
||||
@ -52,21 +52,26 @@ public class PngImageCreatorImp implements PngImageCreator {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean generatePngImages(File imagePresentationDir, UploadedPresentation pres) throws InterruptedException {
|
||||
private boolean generateSvgImages(File imagePresentationDir, UploadedPresentation pres) throws InterruptedException {
|
||||
String source = pres.getUploadedFile().getAbsolutePath();
|
||||
String dest;
|
||||
String COMMAND = "";
|
||||
boolean done = true;
|
||||
if(SupportedFileTypes.isImageFile(pres.getFileType())){
|
||||
dest = imagePresentationDir.getAbsolutePath() + File.separator + "slide1.png";
|
||||
dest = imagePresentationDir.getAbsolutePath() + File.separator + "slide1.pdf";
|
||||
COMMAND = IMAGEMAGICK_DIR + "/convert " + source + " " + dest;
|
||||
done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
|
||||
source = imagePresentationDir.getAbsolutePath() + File.separator + "slide1.pdf";
|
||||
dest = imagePresentationDir.getAbsolutePath() + File.separator + "slide1.svg";
|
||||
COMMAND = "pdftocairo -rx 300 -ry 300 -svg -q -f 1 -l 1 " + source + " " + dest;
|
||||
done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
|
||||
}else{
|
||||
for(int i=1; i<=pres.getNumberOfPages(); i++){
|
||||
File tmp = new File(imagePresentationDir.getAbsolutePath() + File.separatorChar + "tmp" + File.separatorChar + "slide" + i + ".pdf");
|
||||
File destpng = new File(imagePresentationDir.getAbsolutePath() + File.separatorChar + "slide" + i + ".png");
|
||||
COMMAND = IMAGEMAGICK_DIR + "/convert -density 300x300 -quality 90 +dither -depth 8 -colors 256 " + File.separatorChar + tmp.getAbsolutePath() + " " + destpng.getAbsolutePath();
|
||||
File destsvg = new File(imagePresentationDir.getAbsolutePath() + File.separatorChar + "slide" + i + ".svg");
|
||||
COMMAND = "pdftocairo -rx 300 -ry 300 -svg -q -f 1 -l 1 " + File.separatorChar + tmp.getAbsolutePath() + " " + destsvg.getAbsolutePath();
|
||||
|
||||
done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
if(!done){
|
||||
@ -78,12 +83,12 @@ public class PngImageCreatorImp implements PngImageCreator {
|
||||
if (done) {
|
||||
return true;
|
||||
}
|
||||
log.warn("Failed to create png images: " + COMMAND);
|
||||
log.warn("Failed to create svg images: " + COMMAND);
|
||||
return false;
|
||||
}
|
||||
|
||||
private File determinePngImagesDirectory(File presentationFile) {
|
||||
return new File(presentationFile.getParent() + File.separatorChar + "pngs");
|
||||
private File determineSvgImagesDirectory(File presentationFile) {
|
||||
return new File(presentationFile.getParent() + File.separatorChar + "svgs");
|
||||
}
|
||||
|
||||
private void cleanDirectory(File directory) {
|
@ -21,9 +21,9 @@ package org.bigbluebutton.presentation.imp;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.bigbluebutton.api.messaging.MessagingConstants;
|
||||
import org.bigbluebutton.api.messaging.MessagingService;
|
||||
import org.bigbluebutton.api.messaging.MessagingService;
|
||||
import org.bigbluebutton.presentation.ConversionMessageConstants;
|
||||
import org.bigbluebutton.presentation.ConversionUpdateMessage;
|
||||
import org.bigbluebutton.presentation.GeneratedSlidesInfoHelper;
|
||||
@ -47,7 +47,7 @@ public class SwfSlidesGenerationProgressNotifier {
|
||||
String updateMsg = gson.toJson(msg);
|
||||
log.debug("SENDING: " + updateMsg);
|
||||
messagingService.send(MessagingConstants.TO_PRESENTATION_CHANNEL, updateMsg);
|
||||
log.debug("SENT: " + updateMsg);
|
||||
log.debug("SENT: " + updateMsg);
|
||||
} else {
|
||||
log.warn("MessagingService has not been set");
|
||||
}
|
||||
@ -98,9 +98,9 @@ public class SwfSlidesGenerationProgressNotifier {
|
||||
notifyProgressListener(builder.build().getMessage());
|
||||
}
|
||||
|
||||
public void sendCreatingPngImagesUpdateMessage(UploadedPresentation pres) {
|
||||
public void sendCreatingSvgImagesUpdateMessage(UploadedPresentation pres) {
|
||||
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
|
||||
builder.messageKey(ConversionMessageConstants.GENERATING_PNGIMAGES_KEY);
|
||||
builder.messageKey(ConversionMessageConstants.GENERATING_SVGIMAGES_KEY);
|
||||
notifyProgressListener(builder.build().getMessage());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user