本文整理汇总了Java中com.google.gdata.data.youtube.VideoEntry类的典型用法代码示例。如果您正苦于以下问题:Java VideoEntry类的具体用法?Java VideoEntry怎么用?Java VideoEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoEntry类属于com.google.gdata.data.youtube包,在下文中一共展示了VideoEntry类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeVideo
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
private void removeVideo(YouTubeService service, NodeRef nodeRef) throws MalformedURLException, IOException,
ServiceException
{
NodeService nodeService = getNodeService();
if (nodeService.hasAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET))
{
String youtubeId = (String) nodeService.getProperty(nodeRef, PublishingModel.PROP_ASSET_ID);
if (youtubeId != null)
{
String videoEntryUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads/" + youtubeId;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
videoEntry.delete();
nodeService.removeAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET);
nodeService.removeAspect(nodeRef, PublishingModel.ASPECT_ASSET);
}
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:YouTubeChannelType.java
示例2: retrieveVideos
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
public List<YouTubeVideo> retrieveVideos(String textQuery, int maxResults, boolean filter, int timeout, int startIndex) throws Exception {
YouTubeService service = new YouTubeService(clientID);
service.setConnectTimeout(timeout); // millis
YouTubeQuery query = new YouTubeQuery(new URL(YOUTUBE_URL));
query.setOrderBy(YouTubeQuery.OrderBy.RELEVANCE);
query.setFullTextQuery(textQuery);
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
query.setMaxResults(maxResults);
query.setStartIndex(startIndex);
query.addCustomParameter(new Query.CustomParameter("hd", "true"));
VideoFeed videoFeed = service.query(query, VideoFeed.class);
List<VideoEntry> videos = videoFeed.getEntries();
return convertVideos(videos);
}
开发者ID:hamdikavak,项目名称:youtube-search-tool,代码行数:20,代码来源:YouTubeManager.java
示例3: uploadVideo
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
/**
* Metóda uploadVideo slúži na odovzdanie multimediálneho video a súboru na server YouTube. Taktiež priradzuje k videu aj detaily o videosúbore a detaily o serveri s kadiaľ je odovzdávaný.
* @param file - video multimediálny súbor, zapísaný v štruktúre FileImpl
* @param user - používateľ (majiteľ), ktorý daný video multimediálnych súbor odovzdáva z potálu
* @param name - názov vytváranej trasy ku ktorej daný súbor patrí
* @param ID - poradove číslo multimediálneho súboru v danej trase
* @return Navratová hodnota je ID daného odovzdaneho multimedialneho súboru, pomocou ktoreho sa ten da vyvolať na serveri YouTube
* @throws YouTubeAgentException je vyhodená ppri problemoch s odovzdaním video multimediálneho súboru
*/
public String uploadVideo (FileImpl file, String user, String name, String ID) throws YouTubeAgentException{
try {
VideoEntry newEntry = new VideoEntry();
YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent(user + "=" + name + "=" + ID);
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("GPSWebApp");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("This video has been uploaded from GPSWebApp server, and it is property of GPSWebApp server.");
//mg.setPrivate(true);
//mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
//mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));
MediaFileSource ms = new MediaFileSource(new File(file.getPath()), "video/quicktime");
newEntry.setMediaSource(ms);
String uploadUrl = "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
//
XmlBlob xmlBlob = new XmlBlob();
xmlBlob.setBlob("<yt:accessControl action='list' permission='denied'/>");
newEntry.setXmlBlob(xmlBlob);
//
VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);
System.out.println("Video has been uploaded to YouTube: " + createdEntry.getMediaGroup().getPlayer().getUrl());
FileLogger.getInstance().createNewLog("Successfully uploaded video to YouTube with URL " + createdEntry.getMediaGroup().getPlayer().getUrl() + " .");
return createdEntry.getMediaGroup().getVideoId();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("ERROR: Cannot upload video to YouTube server!!!");
FileLogger.getInstance().createNewLog("ERROR: Cannot upload video to YouTube with ID !!!");
throw new YouTubeAgentException();
}
}
开发者ID:lp190zn,项目名称:gTraxxx,代码行数:47,代码来源:YouTubeAgent.java
示例4: deleteVideo
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
/**
* Metóda deleteVideo slúži na vymazanie odovzdaného video multimediálneho súboru zo servera YouTube.
* @param videoID - ID daného video multimediálneho súboru odovzdaného na portály YOuTube
* @throws YouTubeAgentException je vyhodená pri problémoch s vymazaním videa zo serveru YouTube
*/
public void deleteVideo(String videoID) throws YouTubeAgentException{
try {
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/users/default/uploads/" + videoID;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
videoEntry.delete();
FileLogger.getInstance().createNewLog("Successfully deleted video from youtube with ID " + videoID + " .");
} catch (Exception ex) {
System.out.println("ERROR: Cannot delete video from YouTube server!!!");
FileLogger.getInstance().createNewLog("ERROR: Cannot delete video from YouTube with ID " + videoID + " !!!");
//throw new YouTubeAgentException();
}
}
开发者ID:lp190zn,项目名称:gTraxxx,代码行数:18,代码来源:YouTubeAgent.java
示例5: localizeVideoFeed
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
/** converts a VideoFeed object to XML-style document */
private String localizeVideoFeed(VideoFeed videoFeed) {
String content = "<m:Entries>";
for(VideoEntry videoEntry : videoFeed.getEntries() ) {
content += localizeVideoEntry(videoEntry);
}
content += "</m:Entries>";
return content;
}
开发者ID:wzhishen,项目名称:youtube-cache,代码行数:10,代码来源:YouTubeClient.java
示例6: localizeVideoEntry
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
/** converts a VideoEntry object to XML-style document */
private String localizeVideoEntry(VideoEntry videoEntry) {
String content = "<m:Entry>";
// title
content += "<m:Title>"+videoEntry.getTitle().getPlainText()+"</m:Title>";
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
// uploader
content += "<m:Uploader>"+mediaGroup.getUploader()+"</m:Uploader>";
// video ID
content += "<m:Id>"+mediaGroup.getVideoId()+"</m:Id>";
// description
content += "<m:Description>"+mediaGroup.getDescription().getPlainTextContent()+"</m:Description>";
// video URL
MediaPlayer mediaPlayer = mediaGroup.getPlayer();
content += "<m:Url>"+mediaPlayer.getUrl()+"</m:Url>";
// video rating
Rating rating = videoEntry.getRating();
content += "<m:Rating>"+(rating != null ? rating.getAverage() : "No Rating :(")+"</m:Rating>";
// view count
YtStatistics stats = videoEntry.getStatistics();
content += "<m:Count>"+(stats != null ? stats.getViewCount() : "No View Count :/")+"</m:Count>";
// thumbnails
content += "<m:Thumbnails>";
for(MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
// only retrieve small pics
if (mediaThumbnail.getWidth() > 150) continue;
content += "<m:Thumbnail>"+mediaThumbnail.getUrl()+"</m:Thumbnail>";
}
content += "</m:Thumbnails>";
content += "</m:Entry>";
return normalize(content);
}
开发者ID:wzhishen,项目名称:youtube-cache,代码行数:40,代码来源:YouTubeClient.java
示例7: execute
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Facade facade = Facade.getInstance();
int idActivity = Integer.valueOf(request.getParameter("idActivity"));
VideoIriz video = facade.getVideoByID(idActivity);
String status = "activities.video.status.ok";
String okStatus = "activities.video.status.ok";
String watchLink = "";
if (video.isUploaded()) {
YouTubeService service = new YouTubeService(
"ytapi-Amadeus-Amadeus-31t3bfbl-0",
"AI39si4lPYVDXG8xROx-bAoe-vIODvTOcucDwRb-"
+ "_2Ty6pesAsS3R2ybTp6D44a4FZy3Wi0dqls44Cur0-qiuDLCNdihPYBRmw");
service.setAuthSubToken("CIyFvq-NDRCrmPDjBQ", null);
String feedUrl = "http://gdata.youtube.com/feeds/api/users/amadeuslms/uploads";
VideoFeed videoFeed;
VideoEntry entry = null;
try {
videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
for (VideoEntry videoInstance : videoFeed.getEntries()) { //search for the video entry
if (UtilActivities.getVideoId(videoInstance.getId())
.equals(video.getYoutubeId())) {
entry = videoInstance;
}
}
if(entry == null){
status = "activities.video.status.invalidURL";
}
if (entry.isDraft()) {
YtPublicationState pubState = entry.getPublicationState();
if (pubState.getState() == YtPublicationState.State.PROCESSING) {
status = "activities.video.status.processing";
} else if (pubState.getState() == YtPublicationState.State.REJECTED) {
status = "activities.video.status.rejected";
//System.out.println(pubState.getDescription()); // why it was rejected
//System.out.print("For help visit: ");
//System.out.println(pubState.getHelpUrl());
} else if (pubState.getState() == YtPublicationState.State.FAILED) {
status = "activities.video.status.failed";
//System.out.println(pubState.getDescription()); //why it failed
//System.out.print("For help visit: ");
//System.out.println(pubState.getHelpUrl());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(status.equals("activities.video.status.ok")){
watchLink = "<a onclick='watchVideo" +
"('"+ request.getContextPath() +"/jsp/course/content_management" +
"/activities/video/iriz.jsp?idVideo="+ video.getYoutubeId() +"');' href='javascript" +
":void(0);' ><bean:message key='activities.video.watch' /></a>";
}else{
watchLink = "<bean:message key='activities.video.watch' />";
}
request.setAttribute("watchLink", watchLink);
request.setAttribute("video", video);
request.setAttribute("status", status);
request.setAttribute("okStatus", okStatus);
return mapping.findForward(FORWARD_VIDEO_STATUS);
}
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:78,代码来源:ShowVideoIrizStatusAction.java
示例8: convertVideos
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
private List<YouTubeVideo> convertVideos(List<VideoEntry> videos) {
List<YouTubeVideo> youtubeVideosList = new LinkedList<YouTubeVideo>();
int duration;
boolean isRelated;
for (VideoEntry videoEntry : videos) {
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
try{
duration = mediaGroup.getYouTubeContents().get(0).getDuration();
}
catch(Exception e){
duration=0;
}
isRelated = true;//checkContext(videoEntry.getTitle().getPlainText(), mediaGroup.getDescription().getPlainTextContent());
if(duration <= 300 && isRelated==true){
YouTubeVideo ytv = new YouTubeVideo();
String personName="";
for(Person p: videoEntry.getAuthors()){
personName+=p.getName();
break;
}
String webPlayerUrl = mediaGroup.getPlayer().getUrl();
ytv.setWebPlayerUrl(webPlayerUrl);
ytv.setDuration( duration );
ytv.setDescription(mediaGroup.getDescription().getPlainTextContent());
ytv.setVideoOwner(personName);
String query = "?v=";
int index = webPlayerUrl.indexOf(query);
String embeddedWebPlayerUrl = webPlayerUrl.substring(index+query.length());
embeddedWebPlayerUrl = YOUTUBE_EMBEDDED_URL + embeddedWebPlayerUrl;
ytv.setEmbeddedWebPlayerUrl(embeddedWebPlayerUrl);
List<String> thumbnails = new LinkedList<String>();
for (MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
thumbnails.add(mediaThumbnail.getUrl());
}
ytv.setThumbnails(thumbnails);
List<YouTubeMedia> medias = new LinkedList<YouTubeMedia>();
for (YouTubeMediaContent mediaContent : mediaGroup.getYouTubeContents()) {
medias.add(new YouTubeMedia(mediaContent.getUrl(), mediaContent.getType()));
}
ytv.setMedias(medias);
ytv.setTitle(videoEntry.getTitle().getPlainText());
//ytv.setDescription(videoEntry.getTextContent().getContent().getPlainText());
String[] idParts = videoEntry.getId().split(":");
ytv.setVideoId(idParts[idParts.length-1]);
youtubeVideosList.add(ytv);
}
}
return youtubeVideosList;
}
开发者ID:hamdikavak,项目名称:youtube-search-tool,代码行数:65,代码来源:YouTubeManager.java
示例9: convertEntries
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
private List<YouTubeVideo> convertEntries(List<VideoEntry> videoEntries) {
List<YouTubeVideo> youtubeVideosList = new ArrayList<YouTubeVideo>();
int duration, qIndex;
String personName="", query = "?v=", webPlayerUrl, embeddedWebPlayerUrl;
List<String> thumbnails;
List<YouTubeMedia> medias;
String[] idParts;
for (VideoEntry videoEntry : videoEntries) {
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
try{
duration = mediaGroup.getYouTubeContents().get(0).getDuration();
}
catch(Exception e){
duration=0;
}
//isRelated = true;//checkContext(videoEntry.getTitle().getPlainText(), mediaGroup.getDescription().getPlainTextContent());
YouTubeVideo ytv = new YouTubeVideo();
personName="";
for(Person p: videoEntry.getAuthors()){
personName += p.getName();
break;
}
webPlayerUrl = mediaGroup.getPlayer().getUrl();
ytv.setWebPlayerUrl(webPlayerUrl);
ytv.setDuration( duration );
ytv.setDescription(mediaGroup.getDescription().getPlainTextContent());
ytv.setVideoOwner(personName);
qIndex = webPlayerUrl.indexOf(query);
embeddedWebPlayerUrl = webPlayerUrl.substring(qIndex + query.length());
embeddedWebPlayerUrl = YOUTUBE_EMBEDDED_URL + embeddedWebPlayerUrl;
ytv.setEmbeddedWebPlayerUrl(embeddedWebPlayerUrl);
thumbnails = new LinkedList<String>();
for (MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
thumbnails.add(mediaThumbnail.getUrl());
}
ytv.setThumbnails(thumbnails);
medias = new LinkedList<YouTubeMedia>();
for (YouTubeMediaContent mediaContent : mediaGroup.getYouTubeContents()) {
medias.add(new YouTubeMedia(mediaContent.getUrl(), mediaContent.getType()));
}
ytv.setMedias(medias);
ytv.setTitle(videoEntry.getTitle().getPlainText());
idParts = videoEntry.getId().split(":");
ytv.setVideoId(idParts[idParts.length-1]);
youtubeVideosList.add(ytv);
}
return youtubeVideosList;
}
开发者ID:hamdikavak,项目名称:youtube-search-tool,代码行数:70,代码来源:YouTubeSearchTool.java
示例10: lookupVideo
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
public List<String> lookupVideo(String searchTerm) throws IOException, ServiceException {
List<String> results = new ArrayList<String>();
YouTubeService service = new YouTubeService("savetheenvironment");
YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
query.setFullTextQuery(searchTerm);
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
VideoFeed videoFeed = service.query(query, VideoFeed.class);
for (VideoEntry videoEntry : videoFeed.getEntries()) {
results.add(videoEntry.getTitle().getPlainText());
}
return results;
}
开发者ID:joshlong,项目名称:adaptive-spring,代码行数:21,代码来源:VideoSearchYouTube.java
示例11: createThumbnailsBoth
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
public void createThumbnailsBoth(){
int numVids = vAct.videoFeed1.getEntries().size();
/*************
anim1 = new Animator[numVids];
anim2 = new Animator[numVids];
***********/
centerImg1 = new ImageZone[numVids];
centerImg2 = new ImageZone[numVids];
centerText1 = new TextZone[numVids];
centerText2 = new TextZone[numVids];
currentImgs1 = new ImageZone[numVids];
currentImgs2 = new ImageZone[numVids];
playButton1 = new ImageZone[numVids];
playButton2 = new ImageZone[numVids];
background1 = new RectZone[numVids];
background2 = new RectZone[numVids];
final int space = (sketch.getWidth()-sketch.lineX)/12;
final int yPos = sketch.getHeight()/2;
final int imageX = (sketch.getWidth()-sketch.lineX)/5;
final float tSize = (float) (space/4.8);
for(int i = 0; i < numVids; i++){
if(!stopped){
VideoEntry video = vAct.videoFeed1.getEntries().get(i);
YouTubeMediaGroup mediaGroup = video.getMediaGroup();
final PImage img = sketch.loadImage(mediaGroup.getThumbnails().get(0).getUrl());
final String text = mediaGroup.getTitle().getPlainTextContent();
if(!vAct.playerActive){
createImgZone1(img, space, yPos, imageX, text, i, tSize);
}
if(!vAct.playerActive){
createImgZone2(img, space, yPos, imageX, text, i, tSize);
}
if(!vAct.playerActive && sleepTime > 0){
pullToTop();
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
if(!stopped){
imgsLoaded1 = true;
imgsLoaded2 = true;
vAct.moreVideos1.setTextColour(Colours.zoneText.getRed(), Colours.zoneText.getGreen(), Colours.zoneText.getBlue());
vAct.moreVideos1.setColour(Colours.unselectedZone.getRed(), Colours.unselectedZone.getGreen(), Colours.unselectedZone.getBlue());
vAct.moreVideos2.setTextColour(Colours.zoneText.getRed(), Colours.zoneText.getGreen(), Colours.zoneText.getBlue());
vAct.moreVideos2.setColour(Colours.unselectedZone.getRed(), Colours.unselectedZone.getGreen(), Colours.unselectedZone.getBlue());
}
}
开发者ID:vialab,项目名称:TandemTable,代码行数:69,代码来源:VideoGetter.java
示例12: YoutubePost
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
public YoutubePost(VideoEntry videoEntry, YoutubeAccount user) {
this(videoEntry);
//User that posted the post
contributor = user;
for (Item mItem : this.items) {
mItem.setContributor(contributor);
}
}
开发者ID:MKLab-ITI,项目名称:simmo,代码行数:13,代码来源:YoutubePost.java
示例13: YoutubeItem
import com.google.gdata.data.youtube.VideoEntry; //导入依赖的package包/类
public YoutubeItem(VideoEntry videoEntry, YoutubeStreamUser user) {
this(videoEntry);
//User that posted the post
streamUser = user;
uid = streamUser.getId();
for(MediaItem mItem : this.mediaItems) {
mItem.setUserId(uid);
}
}
开发者ID:socialsensor,项目名称:socialmedia-abstractions,代码行数:14,代码来源:YoutubeItem.java
注:本文中的com.google.gdata.data.youtube.VideoEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论