Package org.olat.modules.webFeed.models

Examples of org.olat.modules.webFeed.models.Enclosure


      entry.setLink(helper.getJumpInLink() + "#" + item.getGuid());
      entry.setPublishedDate(item.getPublishDate());
      entry.setUpdatedDate(item.getLastModified());

      // The enclosure is the media (audio or video) file of the episode
      Enclosure media = item.getEnclosure();
      if (media != null) {
        SyndEnclosure enclosure = new SyndEnclosureImpl();
        enclosure.setUrl(helper.getMediaUrl(item));
        enclosure.setType(media.getType());
        enclosure.setLength(media.getLength());
        // Also set the item link to point to the enclosure
        entry.setLink(helper.getMediaUrl(item));
        List<SyndEnclosure> enclosures = new ArrayList<SyndEnclosure>();
        enclosures.add(enclosure);
        entry.setEnclosures(enclosures);
View Full Code Here


   * @param item
   * @return The media url of the item
   */
  public String getMediaUrl(Item item) {
    String file = null;
    Enclosure enclosure = item.getEnclosure();
    if (enclosure != null) {
      if (feed.isExternal()) {
        file = item.getEnclosure().getExternalUrl();
      } else if (feed.isInternal()) {
        file = this.baseUri + "/" + item.getGuid() + "/" + MEDIA_DIR + "/" + enclosure.getFileName();
      }
    }
    return file;
  }
View Full Code Here

    e.setPublishDate(entry.getPublishedDate());

    for (Object enclosure : entry.getEnclosures()) {
      if (enclosure instanceof SyndEnclosure) {
        SyndEnclosure syndEnclosure = (SyndEnclosure) enclosure;
        Enclosure media = new Enclosure();
        media.setExternalUrl(syndEnclosure.getUrl());
        media.setType(syndEnclosure.getType());
        media.setLength(syndEnclosure.getLength());
        e.setEnclosure(media);
      }
      // Break after one cycle because only one media file is supported
      break;
    }
View Full Code Here

      uploadedFile.renameTo(renamed);
      VFSLeaf mediaFile = new LocalFileImpl(renamed);
      itemMediaContainer.copyFrom(mediaFile);

      // Update the enclosure
      Enclosure enclosure = new Enclosure();
      enclosure.setFileName(saveFileName);
      enclosure.setLength(renamed.length());
      enclosure.setType(file.getUploadMimeType());

      item.setEnclosure(enclosure);
    }
  }
View Full Code Here

   * @see org.olat.modules.webFeed.managers.FeedManager#getItemMediaContainer(org.olat.modules.webFeed.models.Item,
   *      org.olat.modules.webFeed.models.Feed)
   */
  public File getItemEnclosureFile(Item item, Feed feed) {
    VFSContainer mediaDir = getItemMediaContainer(item, feed);
    Enclosure enclosure = item.getEnclosure();
    File file = null;
    if (mediaDir != null && enclosure != null) {
      VFSLeaf mediaFile = (VFSLeaf) mediaDir.resolve(enclosure.getFileName());
      if (mediaFile != null && mediaFile instanceof LocalFileImpl) {
        file = ((LocalFileImpl) mediaFile).getBasefile();
      }
    }
    return file;
View Full Code Here

TOP

Related Classes of org.olat.modules.webFeed.models.Enclosure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.