Package com.sun.syndication.feed.module.mediarss

Examples of com.sun.syndication.feed.module.mediarss.MediaEntryModule


        if (jsonAuthor == null) {
          jsonAuthor = e.getAuthor();
        }

        JSONObject media = new JSONObject();
        MediaEntryModule mediaModule = (MediaEntryModule) e.getModule(MediaModule.URI);
        if (mediaModule != null) {
          if (mediaModule.getMediaContents().length > 0) {
            JSONArray contents = new JSONArray();

            for (MediaContent c : mediaModule.getMediaContents()) {
              JSONObject content = new JSONObject();

              if (c.getReference() instanceof UrlReference) {
                content.put("URL", ((UrlReference) c.getReference()).getUrl().toString());
              }

              if (c.getType() != null) {
                content.put("Type", c.getType());
              }

              if (c.getWidth() != null) {
                content.put("Width", c.getWidth());
              }

              if (c.getHeight() != null) {
                content.put("Height", c.getHeight());
              }

              contents.put(content);
            }

            media.put("Contents", contents);
          }

          if (mediaModule.getMetadata() != null) {
            if (mediaModule.getMetadata().getThumbnail().length > 0) {
              // "If multiple thumbnails are included, it is assumed that they are in order of importance"
              // Only use the first thumbnail for simplicity's
              // sake

              JSONObject thumbnail = new JSONObject();

              Thumbnail t = mediaModule.getMetadata().getThumbnail()[0];
              thumbnail.put("URL", t.getUrl().toString());

              if (t.getWidth() != null) {
                thumbnail.put("Width", t.getWidth());
              }
View Full Code Here


        if (jsonAuthor == null) {
          jsonAuthor = e.getAuthor();
        }

        JSONObject media = new JSONObject();
        MediaEntryModule mediaModule = (MediaEntryModule) e.getModule(MediaModule.URI);
        if (mediaModule != null) {
          if (mediaModule.getMediaContents().length > 0) {
            JSONArray contents = new JSONArray();

            for (MediaContent c : mediaModule.getMediaContents()) {
              JSONObject content = new JSONObject();

              if (c.getReference() instanceof UrlReference) {
                content.put("URL", ((UrlReference) c.getReference()).getUrl().toString());
              }

              if (c.getType() != null) {
                content.put("Type", c.getType());
              }

              if (c.getWidth() != null) {
                content.put("Width", c.getWidth());
              }

              if (c.getHeight() != null) {
                content.put("Height", c.getHeight());
              }

              contents.put(content);
            }

            media.put("Contents", contents);
          }

          if (mediaModule.getMetadata() != null) {
            if (mediaModule.getMetadata().getThumbnail().length > 0) {
              // "If multiple thumbnails are included, it is assumed that they are in order of importance"
              // Only use the first thumbnail for simplicity's
              // sake

              JSONObject thumbnail = new JSONObject();

              Thumbnail t = mediaModule.getMetadata().getThumbnail()[0];
              thumbnail.put("URL", t.getUrl().toString());

              if (t.getWidth() != null) {
                thumbnail.put("Width", t.getWidth());
              }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.module.mediarss.MediaEntryModule

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.