use of org.olat.core.commons.services.video.MovieService 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.commons.services.video.MovieService in project openolat by klemens.
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;
}
Aggregations