Skip to content
Snippets Groups Projects
Commit a1407c71 authored by Dixon Fred's avatar Dixon Fred Committed by GitHub
Browse files

Merge pull request #3402 from riadvice/breakout-rooms-slide-conversion

Handle non PDF slide conversion for breakout rooms
parents 886f9617 27fd9922
No related branches found
No related tags found
No related merge requests found
...@@ -49,20 +49,29 @@ public class PresentationUrlDownloadService { ...@@ -49,20 +49,29 @@ public class PresentationUrlDownloadService {
+ File.separator + presentationId); + File.separator + presentationId);
final String presentationFilter = presentationId; final String presentationFilter = presentationId;
FilenameFilter filter = new FilenameFilter() { FilenameFilter pdfFilter = new FilenameFilter() {
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.startsWith(presentationFilter); return name.startsWith(presentationFilter)
&& name.toLowerCase().endsWith("pdf");
} }
}; };
File[] children = sourceMeetingPath.listFiles(filter); File[] matches = sourceMeetingPath.listFiles(pdfFilter);
if (matches.length != 1) {
// No PDF presentation was found, we look for an image presentation
FilenameFilter imgFlter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.startsWith(presentationFilter);
}
};
if (children.length != 1) { matches = sourceMeetingPath.listFiles(imgFlter);
log.error("Not matching file with prefix {} found at {}", }
if (matches.length != 1) {
log.info("Not matching PDF file with prefix {} found at {}",
sourceMeetingId, sourceMeetingPath); sourceMeetingId, sourceMeetingPath);
return;
} else { } else {
File sourcePresentationFile = children[0]; File sourcePresentationFile = matches[0];
String filenameExt = FilenameUtils String filenameExt = FilenameUtils
.getExtension(sourcePresentationFile.getName()); .getExtension(sourcePresentationFile.getName());
String presId = generatePresentationId(presentationId); String presId = generatePresentationId(presentationId);
...@@ -72,13 +81,25 @@ public class PresentationUrlDownloadService { ...@@ -72,13 +81,25 @@ public class PresentationUrlDownloadService {
presentationDir, presId); presentationDir, presId);
String newFilePath = uploadDir.getAbsolutePath() String newFilePath = uploadDir.getAbsolutePath()
+ File.separatorChar + newFilename; + File.separatorChar + newFilename;
File newPresentation = new File(newFilePath);
pageExtractor.extractPage(sourcePresentationFile, new File( if (sourcePresentationFile.getName().toLowerCase().endsWith("pdf")) {
newFilePath), presentationSlide); pageExtractor.extractPage(sourcePresentationFile, new File(
newFilePath), presentationSlide);
} else {
try {
FileUtils.copyFile(sourcePresentationFile, newPresentation);
} catch (IOException e) {
log.error("Could not copy presentation {} to {}",
sourcePresentationFile.getAbsolutePath(),
newPresentation.getAbsolutePath());
e.printStackTrace();
}
}
File pres = new File(newFilePath);
processUploadedFile(destinationMeetingId, presId, "default-" processUploadedFile(destinationMeetingId, presId, "default-"
+ presentationSlide.toString() + "." + filenameExt, pres); + presentationSlide.toString() + "." + filenameExt,
newPresentation);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment