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;
}
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;
}
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;
}
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();
}
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");
}
Aggregations