- add presentation ids to presentation conversion

This commit is contained in:
Richard Alam 2014-02-27 17:23:44 +00:00
parent 9f00d960d1
commit feb49951a5
15 changed files with 96 additions and 117 deletions

View File

@ -26,30 +26,30 @@ public class ConversionUpdatesProcessor {
private PresentationApplication presentationApplication;
public void sendConversionUpdate(String messageKey, String conference,
String code, String presentationId) {
String code, String presId, String presName) {
presentationApplication.sendConversionUpdate(messageKey, conference,
code, presentationId);
code, presId, presName);
}
public void sendPageCountError(String messageKey, String conference,
String code, String presentationId, int numberOfPages,
int maxNumberPages) {
String code, String presId, int numberOfPages,
int maxNumberPages, String presName) {
presentationApplication.sendPageCountError(messageKey, conference,
code, presentationId, numberOfPages,
maxNumberPages);
code, presId, numberOfPages,
maxNumberPages, presName);
}
public void sendSlideGenerated(String messageKey, String conference,
String code, String presentationId, int numberOfPages,
int pagesCompleted) {
String code, String presId, int numberOfPages,
int pagesCompleted, String presName) {
presentationApplication.sendSlideGenerated(messageKey, conference,
code, presentationId, numberOfPages, pagesCompleted);
code, presId, numberOfPages, pagesCompleted, presName);
}
public void sendConversionCompleted(String messageKey, String conference,
String code, String presentation, Integer numberOfPages) {
String code, String presId, Integer numberOfPages, String presName) {
presentationApplication.sendConversionCompleted(messageKey, conference,
code, presentation, numberOfPages);
code, presId, numberOfPages, presName);
}
public void setPresentationApplication(PresentationApplication a) {

View File

@ -21,9 +21,6 @@ package org.bigbluebutton.conference.service.presentation;
import org.slf4j.Logger;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory;
import java.util.Map;
public class PresentationApplication {
private static Logger log = Red5LoggerFactory.getLogger( PresentationApplication.class, "bigbluebutton" );
@ -33,37 +30,35 @@ public class PresentationApplication {
public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) {
bbbInGW = inGW;
}
public void clear(String meetingID) {
}
public void sendConversionUpdate(String messageKey, String meetingId,
String code, String presentationId) {
String code, String presentationId, String presName) {
bbbInGW.sendConversionUpdate(messageKey, meetingId, code,
presentationId);
presentationId, presName);
}
public void sendPageCountError(String messageKey, String meetingId,
String code, String presentationId, int numberOfPages,
int maxNumberPages) {
int maxNumberPages, String presName) {
bbbInGW.sendPageCountError(messageKey, meetingId, code,
presentationId, numberOfPages, maxNumberPages);
presentationId, numberOfPages, maxNumberPages, presName);
}
public void sendSlideGenerated(String messageKey, String meetingId,
String code, String presentationId, int numberOfPages,
int pagesCompleted) {
int pagesCompleted, String presName) {
bbbInGW.sendSlideGenerated(messageKey, meetingId, code,
presentationId, numberOfPages, pagesCompleted);
presentationId, numberOfPages, pagesCompleted, presName);
}
public void sendConversionCompleted(String messageKey, String meetingId,
String code, String presentation, int numberOfPages) {
String code, String presentation, int numberOfPages, String presName) {
bbbInGW.sendConversionCompleted(messageKey, meetingId,
code, presentation, numberOfPages);
code, presentation, numberOfPages, presName);
}
public void removePresentation(String meetingID, String presentationID){

View File

@ -27,32 +27,33 @@ public class PresentationMessageListener implements MessageHandler {
}
private void sendConversionUpdate(String messageKey, String conference,
String code, String presentation) {
String code, String presId, String filename) {
conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference,
code, presentation);
code, presId, filename);
}
public void sendPageCountError(String messageKey, String conference,
String code, String presentation, Integer numberOfPages,
Integer maxNumberPages) {
String code, String presId, Integer numberOfPages,
Integer maxNumberPages, String filename) {
conversionUpdatesProcessor.sendPageCountError(messageKey, conference,
code, presentation, numberOfPages,
maxNumberPages);
code, presId, numberOfPages,
maxNumberPages, filename);
}
private void sendSlideGenerated(String messageKey, String conference,
String code, String presentation, Integer numberOfPages,
Integer pagesCompleted) {
String code, String presId, Integer numberOfPages,
Integer pagesCompleted, String filename) {
conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference,
code, presentation, numberOfPages,
pagesCompleted);
code, presId, numberOfPages,
pagesCompleted, filename);
}
private void sendConversionCompleted(String messageKey, String conference,
String code, String presentation, Integer numberOfPages) {
String code, String presId, Integer numberOfPages,
String filename) {
conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference,
code, presentation, numberOfPages);
code, presId, numberOfPages, filename);
}
@ -64,8 +65,8 @@ public class PresentationMessageListener implements MessageHandler {
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
String code = (String) map.get("returnCode");
String room = (String) map.get("room");
String presentationName = (String) map.get("presentationName");
String presId = (String) map.get("presentationId");
String filename = (String) map.get("filename");
String conference = (String) map.get("conference");
String messageKey = (String) map.get("messageKey");
@ -77,26 +78,26 @@ public class PresentationMessageListener implements MessageHandler {
messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY)||
messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){
sendConversionUpdate(messageKey, conference, code, presentationName);
sendConversionUpdate(messageKey, conference, code, presId, filename);
} else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
Integer maxNumberPages = new Integer((String) map.get("maxNumberPages"));
sendPageCountError(messageKey, conference, code,
presentationName, numberOfPages, maxNumberPages);
presId, numberOfPages, maxNumberPages, filename);
} else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
Integer pagesCompleted = new Integer((String) map.get("pagesCompleted"));
sendSlideGenerated(messageKey, conference, code,
presentationName, numberOfPages, pagesCompleted);
presId, numberOfPages, pagesCompleted, filename);
} else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
sendConversionCompleted(messageKey, conference, code,
presentationName, numberOfPages);
presId, numberOfPages, filename);
}
}
}

View File

@ -67,18 +67,18 @@ public interface IBigBlueButtonInGW {
void getSlideInfo(String meetingID, String requesterID);
void sendConversionUpdate(String messageKey, String meetingId,
String code, String presentation);
String code, String presId, String presName);
void sendPageCountError(String messageKey, String meetingId,
String code, String presentation, int numberOfPages,
int maxNumberPages);
String code, String presId, int numberOfPages,
int maxNumberPages, String presName);
void sendSlideGenerated(String messageKey, String meetingId,
String code, String presentation, int numberOfPages,
int pagesCompleted);
String code, String presId, int numberOfPages,
int pagesCompleted, String presName);
void sendConversionCompleted(String messageKey, String meetingId,
String code, String presentation, int numPages);
String code, String presId, int numPages, String presName);
// Polling
void getPolls(String meetingID, String requesterID);

View File

@ -22,8 +22,10 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW
// Meeting
def createMeeting2(meetingID: String, record: Boolean, voiceBridge: String) {
println("******************** CREATING MEETING ***************************** ")
bbbGW.accept(new CreateMeeting(meetingID, record, voiceBridge))
/*
val pres = presUtil.getPreuploadedPresentations(meetingID);
if (!pres.isEmpty()) {
var presentations = new scala.collection.immutable.HashMap[String, Presentation]
@ -37,6 +39,8 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW
bbbGW.accept(new PreuploadedPresentations(meetingID, presentations.values.toSeq))
}
*/
}
def destroyMeeting(meetingID: String) {
@ -186,23 +190,23 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW
}
def sendConversionUpdate(messageKey: String, meetingId: String,
code: String, presentationId: String) {
code: String, presentationId: String, presName: String) {
bbbGW.accept(new PresentationConversionUpdate(meetingId, messageKey,
code, presentationId))
code, presentationId, presName))
}
def sendPageCountError(messageKey: String, meetingId: String,
code: String, presentationId: String, numberOfPages: Int,
maxNumberPages: Int) {
maxNumberPages: Int, presName: String) {
bbbGW.accept(new PresentationPageCountError(meetingId, messageKey,
code, presentationId, numberOfPages, maxNumberPages))
code, presentationId, numberOfPages, maxNumberPages, presName))
}
def sendSlideGenerated(messageKey: String, meetingId: String,
code: String, presentationId: String, numberOfPages: Int,
pagesCompleted: Int) {
pagesCompleted: Int, presName: String) {
bbbGW.accept(new PresentationSlideGenerated(meetingId, messageKey,
code, presentationId, numberOfPages, pagesCompleted))
code, presentationId, numberOfPages, pagesCompleted, presName))
}
def generatePresentationPages(numPages: Int):scala.collection.immutable.HashMap[String, Page] = {
@ -221,11 +225,11 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW
}
def sendConversionCompleted(messageKey: String, meetingId: String,
code: String, presentationId: String, numPages: Int) {
code: String, presentationId: String, numPages: Int, presName: String) {
println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ")
val pages = generatePresentationPages(numPages)
val presentation = new Presentation(id=presentationId, name=presentationId, pages=pages)
val presentation = new Presentation(id=presentationId, name=presName, pages=pages)
bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey,
code, presentation))

View File

@ -326,7 +326,8 @@ case class PresentationConversionUpdate(
meetingID: String,
messageKey: String,
code: String,
presentationId: String
presentationId: String,
presName: String
) extends InMessage
case class PresentationPageCountError(
@ -335,7 +336,8 @@ case class PresentationPageCountError(
code: String,
presentationId: String,
numberOfPages: Int,
maxNumberPages: Int
maxNumberPages: Int,
presName: String
) extends InMessage
case class PresentationSlideGenerated(
@ -344,7 +346,8 @@ case class PresentationSlideGenerated(
code: String,
presentationId: String,
numberOfPages: Int,
pagesCompleted: Int
pagesCompleted: Int,
presName: String
) extends InMessage
case class PresentationConversionCompleted(

View File

@ -433,7 +433,8 @@ case class PresentationConversionProgress(
meetingID: String,
messageKey: String,
code: String,
presentationId: String
presentationId: String,
presentationName: String
) extends IOutMessage
case class PresentationConversionError(
@ -442,7 +443,8 @@ case class PresentationConversionError(
code: String,
presentationId: String,
numberOfPages: Int,
maxNumberPages: Int
maxNumberPages: Int,
presentationName: String
) extends IOutMessage
case class PresentationPageGenerated(
@ -451,7 +453,8 @@ case class PresentationPageGenerated(
code: String,
presentationId: String,
numberOfPages: Int,
pagesCompleted: Int
pagesCompleted: Int,
presentationName: String
) extends IOutMessage
case class PresentationConversionDone(

View File

@ -43,21 +43,21 @@ trait PresentationApp {
def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) {
outGW.send(new PresentationConversionProgress(meetingID, msg.messageKey,
msg.code, msg.presentationId))
msg.code, msg.presentationId, msg.presName))
}
def handlePresentationPageCountError(msg: PresentationPageCountError) {
outGW.send(new PresentationConversionError(meetingID, msg.messageKey,
msg.code, msg.presentationId,
msg.numberOfPages,
msg.maxNumberPages))
msg.maxNumberPages, msg.presName))
}
def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) {
outGW.send(new PresentationPageGenerated(meetingID, msg.messageKey,
msg.code, msg.presentationId,
msg.numberOfPages,
msg.pagesCompleted))
msg.pagesCompleted, msg.presName))
}
def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) {

View File

@ -65,6 +65,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
args.put("meetingID", msg.meetingID);
args.put("code", msg.code);
args.put("presentationID", msg.presentationId);
args.put("presentationName", msg.presentationName);
args.put("messageKey", msg.messageKey);
val message = new java.util.HashMap[String, Object]()
@ -82,6 +83,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
args.put("meetingID", msg.meetingID);
args.put("code", msg.code);
args.put("presentationID", msg.presentationId);
args.put("presentationName", msg.presentationName);
args.put("messageKey", msg.messageKey);
args.put("numberOfPages", msg.numberOfPages.toString);
args.put("maxNumberPages", msg.maxNumberPages.toString);
@ -101,6 +103,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
args.put("meetingID", msg.meetingID);
args.put("code", msg.code);
args.put("presentationID", msg.presentationId);
args.put("presentationName", msg.presentationName);
args.put("messageKey", msg.messageKey);
args.put("numberOfPages", msg.numberOfPages.toString);
args.put("pagesCompleted", msg.pagesCompleted.toString);

View File

@ -39,12 +39,13 @@ package org.bigbluebutton.modules.present.events
public static const PRESENTATION_READY:String = "PRESENTATION_READY";
public static const OFFICE_DOC_CONVERSION_SUCCESS:String = "OFFICE_DOC_CONVERSION_SUCCESS";
public static const OFFICE_DOC_CONVERSION_FAILED:String = "OFFICE_DOC_CONVERSION_FAILED";
public static const SUPPORTED_DOCUMENT:String = "SUPPORTED_DOCUMENT";
public static const UNSUPPORTED_DOCUMENT:String = "UNSUPPORTED_DOCUMENT";
public static const PAGE_COUNT_FAILED:String = "PAGE_COUNT_FAILED";
public static const PAGE_COUNT_EXCEEDED:String = "PAGE_COUNT_EXCEEDED";
public static const OFFICE_DOC_CONVERSION_FAILED:String = "OFFICE_DOC_CONVERSION_FAILED";
public static const SUPPORTED_DOCUMENT:String = "SUPPORTED_DOCUMENT";
public static const UNSUPPORTED_DOCUMENT:String = "UNSUPPORTED_DOCUMENT";
public static const PAGE_COUNT_FAILED:String = "PAGE_COUNT_FAILED";
public static const PAGE_COUNT_EXCEEDED:String = "PAGE_COUNT_EXCEEDED";
public var presentationId: String;
public var presentationName:String;
public var data:Object;
public var completedSlides:Number;

View File

@ -19,6 +19,10 @@ package org.bigbluebutton.modules.present.model
return _id;
}
public function get name():String {
return _name;
}
public function isCurrent():Boolean {
return _current;
}

View File

@ -61,7 +61,7 @@ package org.bigbluebutton.modules.present.model
for (var i:int = 0; i < _presentations.length; i++) {
var pres: Presentation = _presentations.getItemAt(i) as Presentation;
presos.push(pres.id);
presos.push(pres.name);
}
return presos;

View File

@ -263,7 +263,6 @@ package org.bigbluebutton.modules.present.services
var presentation:Object = presentations[j];
var preso:Presentation = new Presentation(presentation.id, presentation.name, presentation.current);
// var presoPages:Array = new Array();
var pages:Array = presentation.pages as Array;
for (var k:int = 0; k < pages.length; k++) {
var page:Object = pages[k];
@ -277,7 +276,6 @@ package org.bigbluebutton.modules.present.services
pg.widthRatio = page.withRatio;
pg.heightRatio = page.heightRatio;
// presoPages.push(pg);
preso.addPage(pg);
}
@ -303,10 +301,7 @@ package org.bigbluebutton.modules.present.services
sendPresentationName(presNames[x] as String);
}
}
// Force switching the presenter.
triggerSwitchPresenter();
var curPresName:String = PresentationModel.getInstance().getCurrentPresentationName();
var shareEvent:UploadEvent = new UploadEvent(UploadEvent.PRESENTATION_READY);
@ -321,40 +316,5 @@ package org.bigbluebutton.modules.present.services
dispatcher.dispatchEvent(uploadEvent)
}
/***
* NOTE:
* This is a workaround to trigger the UI to switch to presenter or viewer.
* The reason is that when the user joins, the MadePresenterEvent in UserServiceSO
* doesn't get received by the modules as the modules hasn't started yet.
* Need to redo the proper sequence of events but will take a lot of changes.
* (ralam dec 8, 2011).
*/
public function triggerSwitchPresenter():void {
trace(LOG + "****** triggerSwitchPresenter ***** ");
var dispatcher:Dispatcher = new Dispatcher();
var meeting:Conference = UserManager.getInstance().getConference();
if (meeting.amIPresenter) {
trace(LOG + "PresentSOService:: trigger Switch to Presenter mode ");
var e:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_PRESENTER_MODE);
e.userID = meeting.getMyUserId();
e.presenterName = meeting.getMyName();
e.assignerBy = meeting.getMyUserId();
dispatcher.dispatchEvent(e);
} else {
var p:BBBUser = meeting.getPresenter();
if (p != null) {
trace(LOG + " trigger Switch to Presenter mode ");
var viewerEvent:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_VIEWER_MODE);
viewerEvent.userID = p.userID;
viewerEvent.presenterName = p.name;
viewerEvent.assignerBy = p.userID;
dispatcher.dispatchEvent(viewerEvent);
}
}
}
}
}

View File

@ -0,0 +1,5 @@
package org.bigbluebutton.api.messaging;
public class RedisStorageService {
}

View File

@ -88,7 +88,7 @@ public class TextFileCreatorImp implements TextFileCreator {
}else{
dest = textfilesDir.getAbsolutePath() + File.separator + "slide-";
// sudo apt-get install xpdf-utils
for( int i=1; i<=pres.getNumberOfPages(); i++){
for( int i = 1; i <= pres.getNumberOfPages(); i++){
COMMAND = IMAGEMAGICK_DIR + "/pdftotext -raw -nopgbrk -f "+ i +" -l " + i + " " + source + " " + dest + i + ".txt";
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
if (!done) {