use of org.olat.core.util.vfs.LocalFileImpl in project OpenOLAT by OpenOLAT.
the class VideoManagerImpl method getVideoFile.
/**
* get the File of the videoresource
*/
@Override
public File getVideoFile(OLATResource videoResource) {
VFSContainer masterContainer = getMasterContainer(videoResource);
LocalFileImpl videoFile = (LocalFileImpl) masterContainer.resolve(FILENAME_VIDEO_MP4);
return videoFile.getBasefile();
}
use of org.olat.core.util.vfs.LocalFileImpl in project OpenOLAT by OpenOLAT.
the class VideoTranscodingJob method updateStatus.
private boolean updateStatus(VideoTranscoding videoTranscoding, File transcodedFile, int exitCode) {
VideoManager videoManager = CoreSpringFactory.getImpl(VideoManager.class);
MovieService movieService = CoreSpringFactory.getImpl(MovieService.class);
videoTranscoding = videoManager.getVideoTranscoding(videoTranscoding.getKey());
Size videoSize = movieService.getSize(new LocalFileImpl(transcodedFile), VideoManagerImpl.FILETYPE_MP4);
if (videoSize != null) {
videoTranscoding.setWidth(videoSize.getWidth());
videoTranscoding.setHeight(videoSize.getHeight());
} else {
videoTranscoding.setWidth(0);
videoTranscoding.setHeight(0);
}
if (transcodedFile.exists()) {
videoTranscoding.setSize(transcodedFile.length());
} else {
videoTranscoding.setSize(0);
}
if (exitCode == 0) {
videoTranscoding.setStatus(VideoTranscoding.TRANSCODING_STATUS_DONE);
} else {
log.error("Exit code " + videoTranscoding + ":" + exitCode);
videoTranscoding.setStatus(VideoTranscoding.TRANSCODING_STATUS_ERROR);
}
videoTranscoding = videoManager.updateVideoTranscoding(videoTranscoding);
DBFactory.getInstance().commitAndCloseSession();
return exitCode == 0;
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class ProjectEditDetailsFormController method uploadFiles.
private void uploadFiles(FileElement attachmentFileElement) {
VFSLeaf uploadedItem = new LocalFileImpl(attachmentFileElement.getUploadFile());
projectBrokerManager.saveAttachedFile(project, attachmentFileElement.getUploadFileName(), uploadedItem, courseEnv, courseNode);
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class FileDocumentFactoryTest method getVFSFile.
private VFSLeaf getVFSFile(String filename) {
try {
URL url = FileDocumentFactoryTest.class.getResource(filename);
File file = new File(url.toURI());
return new LocalFileImpl(file);
} catch (URISyntaxException e) {
log.error("", e);
return null;
}
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class FeedFileStorge method loadItemMedia.
/**
* Load the media file of the item.
*
* @param item
* @return
*/
public File loadItemMedia(Item item) {
File file = null;
Enclosure enclosure = item.getEnclosure();
VFSContainer mediaDir = getOrCreateItemMediaContainer(item);
if (mediaDir != null && enclosure != null) {
VFSLeaf mediaFile = (VFSLeaf) mediaDir.resolve(enclosure.getFileName());
if (mediaFile != null && mediaFile instanceof LocalFileImpl) {
file = ((LocalFileImpl) mediaFile).getBasefile();
}
}
return file;
}
Aggregations