Search in sources :

Example 11 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project OpenOLAT by OpenOLAT.

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 12 with VideoTranscoding

use of org.olat.modules.video.VideoTranscoding in project OpenOLAT by OpenOLAT.

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 13 with VideoTranscoding

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

the class VideoTranscodingDAOTest method getVideoTranscodingByKey.

@Test
public void getVideoTranscodingByKey() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    VideoTranscoding vTranscoding = videoTranscodingDao.createVideoTranscoding(resource, 1080, "mp4");
    dbInstance.commitAndCloseSession();
    VideoTranscoding reloadedTranscoding = videoTranscodingDao.getVideoTranscoding(vTranscoding.getKey());
    Assert.assertNotNull(reloadedTranscoding);
    Assert.assertEquals(vTranscoding, reloadedTranscoding);
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) OLATResource(org.olat.resource.OLATResource) Test(org.junit.Test)

Example 14 with VideoTranscoding

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

the class VideoTranscodingDAOTest method deleteVideoTranscoding.

@Test
public void deleteVideoTranscoding() {
    // void deleteVideoTranscoding(VideoTranscoding videoTranscoding) {
    OLATResource resource = JunitTestHelper.createRandomResource();
    // prepare transcodings
    VideoTranscoding vTranscoding1 = videoTranscodingDao.createVideoTranscoding(resource, 1080, "mp4");
    videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
    videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
    videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
    dbInstance.commitAndCloseSession();
    // delete single transcoding
    videoTranscodingDao.deleteVideoTranscoding(vTranscoding1);
    dbInstance.commitAndCloseSession();
    List<VideoTranscoding> results = videoTranscodingDao.getVideoTranscodings(resource);
    Assert.assertEquals(3, results.size());
    // delete all transcodings of resource
    videoTranscodingDao.deleteVideoTranscodings(resource);
    dbInstance.commitAndCloseSession();
    results = videoTranscodingDao.getVideoTranscodings(resource);
    Assert.assertEquals(0, results.size());
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) OLATResource(org.olat.resource.OLATResource) Test(org.junit.Test)

Example 15 with VideoTranscoding

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

the class VideoManagerImpl method getMissingTranscodings.

@Override
public List<Integer> getMissingTranscodings(OLATResource videoResource) {
    // get resolutions which are turned on in the videomodule
    int[] configuredResolutions = videoModule.getTranscodingResolutions();
    // turn the int[]-Array into a List
    List<Integer> configResList = IntStream.of(configuredResolutions).boxed().collect(Collectors.toList());
    List<VideoTranscoding> videoTranscodings = getVideoTranscodings(videoResource);
    for (VideoTranscoding videoTranscoding : videoTranscodings) {
        Integer resolution = videoTranscoding.getResolution();
        configResList.remove(resolution);
    }
    return configResList;
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding)

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