Package com.google.gdata.data.youtube

Examples of com.google.gdata.data.youtube.PlaylistLinkEntry


    return null;
  }

  public String createPlaylist(String title, String description) throws ServiceException {
    PlaylistLinkEntry newEntry = new PlaylistLinkEntry();
    newEntry.setTitle(new PlainTextConstruct(title));
    newEntry.setSummary(new PlainTextConstruct(description));

    try {
      PlaylistLinkEntry createdEntry;
     
      try {
        createdEntry = service.insert(new URL(PLAYLIST_FEED_URL), newEntry);
      } catch(InvalidEntryException e) {
        // If the first attempt to create the playlist fails with this exception,
        // it's most likely due to a duplicate playlist title.
        // So let's make the title unique and try again.
        String newTitle = title + " - " + DateTime.now().toUiString();
        log.info(String.format("Playlist with title '%s' already exists. Attempting to create " +
            "playlist with title '%s'.", title, newTitle));

        newEntry.setTitle(new PlainTextConstruct(newTitle));
       
        createdEntry = service.insert(new URL(PLAYLIST_FEED_URL), newEntry);
      }
     
      String id = createdEntry.getPlaylistId();

      log.info(String.format("Created new playlist with id '%s'.", id));
      return id;
    } catch (MalformedURLException e) {
      log.log(Level.WARNING, "", e);
View Full Code Here


      System.out.println("Enter a title: ");
      String title = readLine();
      System.out.println("Enter a description: ");
      String description = readLine();

      PlaylistLinkEntry newEntry = new PlaylistLinkEntry();
      newEntry.setTitle(new PlainTextConstruct(title));
      newEntry.setSummary(
          TextConstruct.create(TextConstruct.Type.TEXT, description, null));

      service.insert(new URL(feedUrl), newEntry);

      return;
View Full Code Here

TOP

Related Classes of com.google.gdata.data.youtube.PlaylistLinkEntry

Copyright © 2018 www.massapicom. 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.