当前位置: 首页>>代码示例>>Java>>正文


Java Video.getId方法代码示例

本文整理汇总了Java中com.google.api.services.youtube.model.Video.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Video.getId方法的具体用法?Java Video.getId怎么用?Java Video.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.services.youtube.model.Video的用法示例。


在下文中一共展示了Video.getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: itemsToMap

import com.google.api.services.youtube.model.Video; //导入方法依赖的package包/类
private List<YouTubeData> itemsToMap(List<Video> playlistItemList) {
  List<YouTubeData> result = new ArrayList<YouTubeData>();

  // convert the list into hash maps of video info
  for (Video playlistItem : playlistItemList) {
    YouTubeData map = new YouTubeData();

    map.mVideo = playlistItem.getId();
    map.mTitle = playlistItem.getSnippet().getTitle();
    map.mDescription = Utils.condenseWhiteSpace(playlistItem.getSnippet().getDescription());
    map.mThumbnail = thumbnailURL(playlistItem.getSnippet().getThumbnails());
    map.mDuration = Utils.durationToDuration((String) playlistItem.getContentDetails()
        .get("duration"));

    result.add(map);
  }

  return result;
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:20,代码来源:YouTubeAPI.java

示例2: execute

import com.google.api.services.youtube.model.Video; //导入方法依赖的package包/类
protected void execute() throws Throwable {
    String body = message.getBody();
    Uri videoAttachment = message.getVideoAttachment();

    if (videoAttachment != null) {
        // TODO FIXME Make this whole operation (upload video, attach video to message, submit message) atomic.
        // TODO FIXME Please. This should be properly configured through injection or something.
        String topicUrl = "https://edemocracia.camara.gov.br"
                + "/c/message_boards/find_message?p_l_id=&messageId="
                + String.valueOf(message.getParentMessageId());

        final Video video = uploadManager
                .upload(message.getId(), message.getVideoAttachment(), message.getSubject(), topicUrl)
                .subscribeOn(Schedulers.newThread())
                .doOnNext(this::notifyProgress)
                .doOnCompleted(this::notifyCompleted)
                .map(YouTubeUploader.UploadProgress::getInsertedVideo)
                .doOnError(this::onError)
                .toBlocking()
                .last();    // Last emitted item has the inserted video

        if (video == null || video.getId() == null)
            // XXX This is not even supposed to ever happen!
            throw new AssertionError("videoId wasn't supposed to be null.");

        // Save the uploaded video inside the message.
        messages.replaceAttachmentWithYouTubeVideo(message, video.getId());

        // XXX Update body without hitting the db.
        // FIXME We should really cook up a new LocalMessage instance.
        body = LocalMessageStore.attachVideo(body, video.getId());
    }

    // FIXME Publishing messages and marking them as successfully submitted is not atomic!
    JSONObject insertedJson = service.addMessage(
            message.getUuid(), message.getGroupId(), message.getCategoryId(),
            message.getThreadId(), message.getParentMessageId(), message.getSubject(), body);

    messages.setSuccess(message.getId(),
            net.labhackercd.nhegatu.data.api.model.Message.JSON_READER.fromJSON(insertedJson));
}
 
开发者ID:labhackercd,项目名称:edm,代码行数:42,代码来源:AddMessageTask.java


注:本文中的com.google.api.services.youtube.model.Video.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。