Search in sources :

Example 1 with MovieService

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;
}
Also used : MovieService(org.olat.core.commons.services.video.MovieService) Size(org.olat.core.commons.services.image.Size) LocalFileImpl(org.olat.core.util.vfs.LocalFileImpl) VideoManager(org.olat.modules.video.VideoManager)

Example 2 with MovieService

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;
}
Also used : MovieService(org.olat.core.commons.services.video.MovieService) Size(org.olat.core.commons.services.image.Size) LocalFileImpl(org.olat.core.util.vfs.LocalFileImpl) VideoManager(org.olat.modules.video.VideoManager)

Aggregations

Size (org.olat.core.commons.services.image.Size)2 MovieService (org.olat.core.commons.services.video.MovieService)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2 VideoManager (org.olat.modules.video.VideoManager)2