Example usage for twitter4j MediaEntity getSizes

List of usage examples for twitter4j MediaEntity getSizes

Introduction

In this page you can find the example usage for twitter4j MediaEntity getSizes.

Prototype

Map<Integer, Size> getSizes();

Source Link

Document

Returns size variations of the media.

Usage

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

static Struct convertMediaEntity(MediaEntity mediaEntity) {
    return new Struct(SCHEMA_MEDIA_ENTITY).put("Id", mediaEntity.getId()).put("Type", mediaEntity.getType())
            .put("MediaURL", mediaEntity.getMediaURL()).put("Sizes", convertSizes(mediaEntity.getSizes()))
            .put("MediaURLHttps", mediaEntity.getMediaURLHttps())
            .put("VideoAspectRatioWidth", mediaEntity.getVideoAspectRatioWidth())
            .put("VideoAspectRatioHeight", mediaEntity.getVideoAspectRatioHeight())
            .put("VideoDurationMillis", mediaEntity.getVideoDurationMillis())
            .put("VideoVariants", convert(mediaEntity.getVideoVariants()))
            .put("ExtAltText", mediaEntity.getExtAltText()).put("URL", mediaEntity.getURL())
            .put("Text", mediaEntity.getText()).put("ExpandedURL", mediaEntity.getExpandedURL())
            .put("Start", mediaEntity.getStart()).put("End", mediaEntity.getEnd())
            .put("DisplayURL", mediaEntity.getDisplayURL());
}

From source file:de.vanita5.twittnuker.model.ParcelableMedia.java

License:Open Source License

public ParcelableMedia(final MediaEntity entity) {
    url = ParseUtils.parseString(entity.getMediaURL());
    media_url = ParseUtils.parseString(entity.getMediaURL());
    start = entity.getStart();//from   www  .jav a 2 s  . c o  m
    end = entity.getEnd();
    type = TYPE_IMAGE;
    final Size size = entity.getSizes().get(Size.LARGE);
    width = size != null ? size.getWidth() : 0;
    height = size != null ? size.getHeight() : 0;
}

From source file:org.xmlsh.twitter.util.TwitterWriter.java

License:BSD License

private void write(String localName, MediaEntity m) throws XMLStreamException {
    startElement(localName);//from  w  w w . jav  a  2s  .c om
    attribute("display-url", m.getDisplayURL());
    attribute("end", m.getEnd());
    attribute("expanded-url", m.getExpandedURL().toString());
    attribute("id", m.getId());
    attribute("media-url", m.getMediaURL().toString());
    attribute("media-url-https", m.getMediaURLHttps().toString());

    attribute("start", m.getStart());
    attribute("url", m.getURL().toString());
    Set<Entry<Integer, Size>> sizes = m.getSizes().entrySet();
    for (Entry<Integer, Size> s : sizes) {
        startElement("size");
        attribute("height", s.getValue().getHeight());
        attribute("width", s.getValue().getWidth());
        attribute("resize", s.getValue().getResize());
        endElement();

    }
}