Examples of MediaFileSource


Examples of com.google.gdata.data.media.MediaFileSource

  public AttachmentEntry uploadAttachment(File file, String parentLink, String description)
      throws IOException, ServiceException  {
    String fileMimeType = mediaTypes.getContentType(file);
   
    AttachmentEntry newAttachment = new AttachmentEntry();
    newAttachment.setMediaSource(new MediaFileSource(file, fileMimeType));
    newAttachment.setTitle(new PlainTextConstruct(file.getName()));
    newAttachment.setSummary(new PlainTextConstruct(description));
    newAttachment.addLink(SitesLink.Rel.PARENT, Link.Type.ATOM, parentLink);
   
    return service.insert(new URL(getContentFeedUrl()), newAttachment);
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

    }

    PhotoEntry myPhoto = new PhotoEntry();
    myPhoto.setClient("NinjaBlogger");

    MediaFileSource myMedia = new MediaFileSource(photo, mediaType);
    myPhoto.setMediaSource(myMedia);

    PhotoEntry returnedPhoto = null;
    try {
      returnedPhoto = service.insert(albumPostUrl, myPhoto);
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

  /**
   * Associate a File with this entry with the specified mime type
   */
  public void setFile(File file, String mimeType) {
    MediaFileSource fileSource = new MediaFileSource(file, mimeType);
    MediaContent content = new MediaContent();
    content.setMediaSource(fileSource);
    content.setMimeType(new ContentType(mimeType));
    setContent(content);
  }
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

  private String attachmentMimeType;
  private String caption;
 
  @Override
  public void execute() throws Exception {
    MediaFileSource media = new MediaFileSource(new File(attachmentFile), attachmentMimeType);
   
    Service service = createService();
    Service.GDataRequest request = service.createRequest(GDataRequest.RequestType.INSERT,
        new URL(itemMediaUrl), new ContentType(attachmentMimeType));
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

    ExecutorService executor =
        Executors.newFixedThreadPool(MAX_CONCURRENT_UPLOADS);
    // Create {@link ResumableGDataFileUploader} for each file to upload
    List<ResumableGDataFileUploader> uploaders = Lists.newArrayList();
    for (String fileName : files) {
      MediaFileSource mediaFile = getMediaFileSource(fileName);
      ResumableGDataFileUploader uploader =
          new ResumableGDataFileUploader.Builder(
              docs.service, new URL(url), mediaFile, null /*empty meatadata*/)
              .title(mediaFile.getName())
              .chunkSize(chunkSize).executor(executor)
              .trackProgress(listener, PROGRESS_UPDATE_INTERVAL)
              .build();
      uploaders.add(uploader);
    }
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

    return listener.getUploaded();
  }

  private MediaFileSource getMediaFileSource(String fileName) {
    File file = new File(fileName);
    MediaFileSource mediaFile = new MediaFileSource(file,
        DocumentListEntry.MediaType.fromFileName(file.getName())
            .getMimeType());
    return mediaFile;
  }
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

    // retrieve latest entry
    DocumentListEntry currentEntry = docs.service.getEntry(
        new URL(DEFAULT_DOCLIST_FEED_URL  + "/" + docIdToUpdate),
        DocumentListEntry.class);

    MediaFileSource mediaFile = getMediaFileSource(filePath);
    ResumableGDataFileUploader uploader =
        new ResumableGDataFileUploader
            .Builder(docs.service, mediaFile, currentEntry)
            .title(mediaFile.getName())
            .requestType(
                ResumableGDataFileUploader.RequestType.UPDATE_MEDIA_ONLY)
            .build();

    uploader.start();
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

  /**
   * Associate a File with this entry with the specified mime type
   */
  public void setFile(File file, String mimeType) {
    MediaFileSource fileSource = new MediaFileSource(file, mimeType);
    MediaContent content = new MediaContent();
    content.setMediaSource(fileSource);
    content.setMimeType(new ContentType(mimeType));
    setContent(content);
  }
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

    mg.getTitle().setPlainTextContent(videoTitle);
    mg.setKeywords(new MediaKeywords());
    mg.getKeywords().addKeyword("gdata-test");
    mg.setDescription(new MediaDescription());
    mg.getDescription().setPlainTextContent(videoTitle);
    MediaFileSource ms = new MediaFileSource(videoFile, mimeType);
    newEntry.setMediaSource(ms);

    try {
      service.insert(new URL(VIDEO_UPLOAD_FEED), newEntry);
    } catch (ServiceException se) {
View Full Code Here

Examples of com.google.gdata.data.media.MediaFileSource

      return;
    }

    output.println(
        "What is the MIME type of this file? (ex. 'video/quicktime' for .mov)");
    MediaFileSource ms = new MediaFileSource(videoFile, readLine());

    output.println("What should I call this video?");
    String videoTitle = readLine();

    VideoEntry newEntry = new VideoEntry();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.