private void prepareContent(Video video, YElement yElement) { YContentFile viedoUrlContnent = new YContentFile(video.getId(), VideoConstants.VIDEO_URL_FILE_TYPE, VideoConstants.YOUTUBE_FORMAT, Collections.singletonList(video.getId())); yElement.addContent(viedoUrlContnent); String thumbnailUrl = parseThumbnailUrl(video); if (thumbnailUrl != null) { // TODO format detect YContentFile thumbnailContent = new YContentFile(video.getId() + "_thumbnail", FileTypes.FT_THUMBNAIL, MediaType.ANY_IMAGE_TYPE.toString(), Collections.singletonList(thumbnailUrl)); yElement.addContent(thumbnailContent); } }
public void updateElementContentLinks(org.jdom.Element ameta, YElement article) { List<org.jdom.Element> selfs = JDOMHelper.getChildren(ameta, "self-uri"); for (org.jdom.Element uri : selfs) { String type = FileTypes.FT_FULL_TEXT; String mime = uri.getAttributeValue("content-type"); if (mime == null) { type = FileTypes.FT_ELEMENT_WEBPAGE; mime = "text/html"; } String href = uri.getAttributeValue("href", XLINK_NAMESPACE); YContentFile contentFile = y.contentFile(href, type, mime, href); if (contentFile!=null) { contentFile.addDescription(new YDescription(YLanguage.English, uri.getValue())); article.addContent(contentFile); } } }
private void appendContents(ResourceData resource, YElement yElement) { for (ResourceData.ResourceFileData content : resource.getContents()) { if (!content.isToBeDeleted()) { final String fileId = content.getId(); final String fileName = content.getName(); if (!checkIfContentPresent(yElement, fileId)) { String mime = ExtendedMimeTypeHelper.resolveTypeForFile(fileName != null ? new File(fileName) : null); List<String> locations = Collections.singletonList(content.getLocation()); yElement.addContent(new YContentFile(fileId, content.getType(), mime, locations).addName(new YName(fileName))); } } } }
yElement.addContent(viedoContnentUrl); YCurrent currentLevel = new YCurrent().setLevel(VideoConstants.VIDEO_CURRENT_LEVEL); yElement.addStructure(new YStructure().setHierarchy(HierarchyWithLevelIds.EXT_HIERARCHY_PUBLICATION).setCurrent(currentLevel)); YContentFile viedoSpeechToTextContent = new YContentFile(id + "_text_" + transliterationPartId, FileTypes.FT_FULL_TEXT, "plain/text", Collections.singletonList(transliterationPartId)); yElement.addContent(viedoSpeechToTextContent); } catch (IOException e) { problemHandler.handleProblem(LogSeverity.WARN, id, "SpeechToText ERROR", "IOException when file read.");
ocrContent.setType(DEFAULT_CONTENT_TYPE); ocrContent.setId(contentPartName); element.addContent(ocrContent); ocrContent.setFormat(format);
article.addContent(new YContentFile().addLocation(aid.getTextTrim()));
leaf.addContent(description);
leaf.addContent(description);
article.addContent(y.contentFile(href, type, mime, href));