Search in sources :

Example 16 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.

the class VideoTranscodingDAO method updateTranscodingStatus.

/**
 * Update transcoding status so TranscodingJob can find the resource.
 *
 * @param videoTranscoding
 * @return updated videoTranscoding
 */
VideoTranscoding updateTranscodingStatus(VideoTranscoding videoTranscoding) {
    ((VideoTranscodingImpl) videoTranscoding).setLastModified(new Date());
    videoTranscoding.setStatus(-1);
    VideoTranscoding trans = dbInstance.getCurrentEntityManager().merge(videoTranscoding);
    return trans;
}
Also used : VideoTranscodingImpl(org.olat.modules.video.model.VideoTranscodingImpl) VideoTranscoding(org.olat.modules.video.VideoTranscoding) Date(java.util.Date)

Example 17 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.

the class VideoTranscodingDAO method updateTranscoding.

/**
 * Merge updated video transcoding, persist on DB
 *
 * @param videoTranscoding
 * @return Updated transcoding object
 */
VideoTranscoding updateTranscoding(VideoTranscoding videoTranscoding) {
    ((VideoTranscodingImpl) videoTranscoding).setLastModified(new Date());
    VideoTranscoding trans = dbInstance.getCurrentEntityManager().merge(videoTranscoding);
    return trans;
}
Also used : VideoTranscodingImpl(org.olat.modules.video.model.VideoTranscodingImpl) VideoTranscoding(org.olat.modules.video.VideoTranscoding) Date(java.util.Date)

Example 18 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.

the class VideoTranscodingJob method getNextVideo.

private VideoTranscoding getNextVideo() {
    VideoManager videoManager = CoreSpringFactory.getImpl(VideoManager.class);
    List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress();
    VideoTranscoding videoTranscoding = null;
    for (VideoTranscoding videoTrans : videoTranscodings) {
        String transcoder = videoTrans.getTranscoder();
        if (transcoder == null) {
            log.info("Start transcoding video with resolution::" + videoTrans.getResolution() + " for video resource::" + videoTrans.getVideoResource().getResourceableId());
            videoTrans.setTranscoder(VideoTranscoding.TRANSCODER_LOCAL);
            videoTranscoding = videoManager.updateVideoTranscoding(videoTrans);
            break;
        } else if (transcoder.equals(VideoTranscoding.TRANSCODER_LOCAL)) {
            log.info("Continue with transcoding video with resolution::" + videoTrans.getResolution() + " for video resource::" + videoTrans.getVideoResource().getResourceableId());
            videoTranscoding = videoTrans;
            break;
        }
    }
    return videoTranscoding;
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) VideoManager(org.olat.modules.video.VideoManager)

Example 19 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.

the class VideoAdminErrorController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink && ((FormLink) source).getCmd().equals("deleteQuality")) {
        FormLink link = (FormLink) source;
        VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
        videoManager.deleteVideoTranscoding(videoTranscoding);
    } else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewAuthor")) {
        showUserInfo(ureq, baseSecurity.findIdentityByName((String) source.getUserObject()));
    } else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("retranscode")) {
        FormLink link = (FormLink) source;
        VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
        videoManager.retranscodeFailedVideoTranscoding(videoTranscoding);
    } else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewResource")) {
        FormLink link = (FormLink) source;
        VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
        launch(ureq, videoTranscoding);
    }
    initTable();
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 20 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.

the class VideoAdminListController method initTable.

private void initTable() {
    List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress();
    List<TranscodingQueueTableRow> rows = new ArrayList<>();
    for (VideoTranscoding videoTranscoding : videoTranscodings) {
        String title = videoManager.getDisplayTitleForResolution(videoTranscoding.getResolution(), getTranslator());
        String resid = String.valueOf(videoTranscoding.getVideoResource().getResourceableId());
        FormLink resourceLink = uifactory.addFormLink("res_" + counter++, "viewResource", resid, resid, flc, Link.LINK + Link.NONTRANSLATED);
        resourceLink.setUserObject(videoTranscoding);
        FormLink deleteLink = uifactory.addFormLink("del_" + counter++, "deleteQuality", "quality.delete", "quality.delete", flc, Link.LINK);
        deleteLink.setUserObject(videoTranscoding);
        deleteLink.setIconLeftCSS("o_icon o_icon_delete_item o_icon-fw");
        String fileSize = "";
        if (videoTranscoding.getSize() != 0) {
            fileSize = Formatter.formatBytes(videoTranscoding.getSize());
        } else if (videoTranscoding.getStatus() == VideoTranscoding.TRANSCODING_STATUS_WAITING) {
            fileSize = translate("transcoding.waiting");
        } else if (videoTranscoding.getStatus() <= VideoTranscoding.TRANSCODING_STATUS_DONE) {
            fileSize = translate("transcoding.processing") + ": " + videoTranscoding.getStatus() + "%";
        }
        RepositoryEntry videoRe = repositoryService.loadByResourceKey(videoTranscoding.getVideoResource().getKey());
        if (videoRe == null)
            continue;
        String displayname = videoRe.getDisplayname();
        String initialAuthor = videoRe.getInitialAuthor();
        String fullName = userManager.getUserDisplayName(initialAuthor);
        FormLink authorLink = uifactory.addFormLink("author_" + counter++, "viewAuthor", fullName, fullName, flc, Link.LINK + Link.NONTRANSLATED);
        authorLink.setUserObject(initialAuthor);
        Date creationDate = videoTranscoding.getCreationDate();
        rows.add(new TranscodingQueueTableRow(resourceLink, displayname, creationDate, authorLink, title, fileSize, videoTranscoding.getFormat(), deleteLink));
    }
    tableModel.setObjects(rows);
    if (flc.hasFormComponent(tableEl)) {
        flc.remove(tableEl);
    }
    if (flc.hasFormComponent(refreshButton)) {
        flc.remove(refreshButton);
    }
    tableEl = uifactory.addTableElement(getWindowControl(), "queue", tableModel, getTranslator(), flc);
    tableEl.setCustomizeColumns(false);
    tableEl.setNumOfRowsEnabled(false);
    refreshButton = uifactory.addFormLink("button.refresh", flc, Link.BUTTON);
    refreshButton.setIconLeftCSS("o_icon o_icon_refresh o_icon-fw");
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Date(java.util.Date)

Aggregations

VideoTranscoding (org.olat.modules.video.VideoTranscoding)34 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 ArrayList (java.util.ArrayList)8 Date (java.util.Date)8 OLATResource (org.olat.resource.OLATResource)8 Test (org.junit.Test)6 VideoMeta (org.olat.modules.video.VideoMeta)6 HashMap (java.util.HashMap)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 VideoMediaMapper (org.olat.modules.video.manager.VideoMediaMapper)4 VideoTranscodingImpl (org.olat.modules.video.model.VideoTranscodingImpl)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Size (org.olat.core.commons.services.image.Size)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 VideoManager (org.olat.modules.video.VideoManager)2 VideoModule (org.olat.modules.video.VideoModule)2 SchedulerException (org.quartz.SchedulerException)2