本文整理汇总了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;
}
示例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));
}