Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Channel


      String[] splittedURI = path.split("/");
      if (splittedURI.length == 3) {
        String user = splittedURI[splittedURI.length - 1];
        user = URLDecoder.decode(user, "UTF8");
        System.out.println("Channel to search : " + user);
        Channel tubChannel = ChannelService.getByUserId(user);
        request.setAttribute("listCategory",
            JavaCacheHandle.getCategory());
        request.setAttribute("url", request.getRequestURL());
        request.setAttribute("listChannel",
            JavaCacheHandle.getChannels());
View Full Code Here


          new URL(
              "https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed?time=all_time&max-results=10&orderby=viewCount&v=2"));
      ChannelFeed channels = service.query(query, ChannelFeed.class);
      result = new ArrayList<Channel>();
      for (ChannelEntry channel : channels.getEntries()) {
        Channel tubChannel = new Channel();
        String[] splittedId = channel.getId().split(":");
        tubChannel
            .setTitle(new Text(channel.getTitle().getPlainText()));
        tubChannel.setAlias(splittedId[splittedId.length - 1]);
        UserProfileEntry profileEntry = service.getEntry(new URL(
            channel.getAuthors().get(0).getUri()),
            UserProfileEntry.class);
        tubChannel.setThumbImageUrl(new Text(profileEntry
            .getThumbnail().getUrl()));
        result.add(tubChannel);
      }
    } catch (MalformedURLException e) {
      System.out.println("Error when get most view channel.");
View Full Code Here

      result = new ArrayList<Channel>();
      List<String> cachedChannels = (List<String>) cache
          .get("cachedChannels");
      if (cachedChannels.size() > 0) {
        for (String stringChannel : cachedChannels) {
          Channel channel = new Channel();
          channel.transformString(stringChannel);
          result.add(channel);
        }
      }
    }
    return result;
View Full Code Here

    }
    return result;
  }

  public static Channel getByUserId(String alias) {
    Channel tubChannel = new Channel();   
    List<Text> listTube = new ArrayList<Text>();
    List<Tube> listSave2DB = new ArrayList<Tube>();
    String feedUrl = "http://gdata.youtube.com/feeds/api/users/" + alias
        + "/uploads";
    service.setConnectTimeout(2000);
    VideoFeed videoFeed;
    try {
      videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(new Text(tub.toString()));
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
       
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
            + " video success !");
      }
      tubChannel.setListTube(listTube);
    } catch (MalformedURLException e) {
      System.out.println("Error when get channel by id : " + alias);
      e.printStackTrace();
    } catch (IOException e) {
      System.out.println("Error when get channel by id : " + alias);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public static Channel getByAlias(String alias) {
    initPm();
    Channel channel = null;
    Query query = pm.newQuery(Channel.class);
    query.setFilter("alias==aliasPara");
    query.declareParameters("java.lang.String aliasPara");
    query.setRange(0, 1);
    List<Channel> listResult = (List<Channel>) query.execute(alias);
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.Channel

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.