Example usage for twitter4j.conf Configuration getMediaProvider

List of usage examples for twitter4j.conf Configuration getMediaProvider

Introduction

In this page you can find the example usage for twitter4j.conf Configuration getMediaProvider.

Prototype

String getMediaProvider();

Source Link

Usage

From source file:cmu.edu.homework.mediaUpload.PhotoUploadFactory.java

License:Apache License

/**
 * Creates an PhotoUploadFactory with the specified configuration
 * @param conf configuration to be associated
 *///from  w w w .  j a va2 s.  c o  m
public PhotoUploadFactory(Configuration conf) {
    String mediaProvider = conf.getMediaProvider().toLowerCase();
    if ("twitter".equals(mediaProvider)) {
        defaultMediaProvider = TWITTER;
    } else if ("imgly".equals(mediaProvider) || "img_ly".equals(mediaProvider)) {
        defaultMediaProvider = IMG_LY;
    } else if ("twipple".equals(mediaProvider)) {
        defaultMediaProvider = TWIPPLE;
    } else if ("yfrog".equals(mediaProvider)) {
        defaultMediaProvider = YFROG;
    } else if ("mobypicture".equals(mediaProvider)) {
        defaultMediaProvider = MOBYPICTURE;
    } else {
        throw new IllegalArgumentException("unsupported media provider:" + mediaProvider);
    }
    this.conf = conf;
    apiKey = conf.getMediaProviderAPIKey();
}

From source file:cmu.edu.homework.mediaUpload.VideoUploadFactory.java

License:Apache License

/**
 * Creates an VideoUploadFactory with the specified configuration
 * @param conf configuration to be associated
 *//*  w  w w .ja va 2s.com*/
public VideoUploadFactory(Configuration conf) {
    String mediaProvider = conf.getMediaProvider().toLowerCase();
    if ("twitter".equals(mediaProvider)) {
        defaultMediaProvider = TWITTER;
    } else if ("imgly".equals(mediaProvider) || "img_ly".equals(mediaProvider)) {
        defaultMediaProvider = IMG_LY;
    } else if ("twipple".equals(mediaProvider)) {
        defaultMediaProvider = TWIPPLE;
    } else if ("yfrog".equals(mediaProvider)) {
        defaultMediaProvider = YFROG;
    } else if ("mobypicture".equals(mediaProvider)) {
        defaultMediaProvider = MOBYPICTURE;
    } else {
        throw new IllegalArgumentException("unsupported media provider:" + mediaProvider);
    }
    this.conf = conf;
    apiKey = conf.getMediaProviderAPIKey();
}