Example usage for com.liferay.portal.util PropsValues DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE

List of usage examples for com.liferay.portal.util PropsValues DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE.

Prototype

int DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE

To view the source code for com.liferay.portal.util PropsValues DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE.

Click Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java

License:Open Source License

private void _generateThumbnailXuggler(FileVersion fileVersion, File file, int height, int width)
        throws Exception {

    StopWatch stopWatch = null;/*from w w  w .ja v  a  2 s . c o m*/

    if (_log.isInfoEnabled()) {
        stopWatch = new StopWatch();

        stopWatch.start();
    }

    String tempFileId = DLUtil.getTempFileId(fileVersion.getFileEntryId(), fileVersion.getVersion());

    File thumbnailTempFile = getThumbnailTempFile(tempFileId);

    try {
        try {
            if (PropsValues.DL_FILE_ENTRY_PREVIEW_FORK_PROCESS_ENABLED) {
                ProcessCallable<String> processCallable = new LiferayVideoThumbnailProcessCallable(
                        ServerDetector.getServerId(), PropsUtil.get(PropsKeys.LIFERAY_HOME),
                        Log4JUtil.getCustomLogSettings(), file.getCanonicalPath(), thumbnailTempFile,
                        THUMBNAIL_TYPE, height, width,
                        PropsValues.DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE);

                ProcessExecutor.execute(processCallable, ClassPathUtil.getPortalClassPath());
            } else {
                LiferayConverter liferayConverter = new LiferayVideoThumbnailConverter(file.getCanonicalPath(),
                        thumbnailTempFile, THUMBNAIL_TYPE, height, width,
                        PropsValues.DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE);

                liferayConverter.convert();
            }
        } catch (Exception e) {
            _log.error(e, e);
        }

        storeThumbnailImages(fileVersion, thumbnailTempFile);

        if (_log.isInfoEnabled()) {
            _log.info("Xuggler generated a thumbnail for " + fileVersion.getTitle() + " in " + stopWatch);
        }
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        FileUtil.delete(thumbnailTempFile);
    }
}