Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Playlist


      HttpSession session = req.getSession();
      String type = (String) req.getParameter("type");
      String channelId = (String) req.getParameter("channelId");
      String playlistId = (String) req.getParameter("playlistId");
      Mission mission = new Mission();
      Playlist pl = PlaylistModel.byId(playlistId, false);
      if (pl != null) {
        if (YoutubeService.checkChannel(channelId)) {
          if (type.equals("2")) {
            YoutubeService tubeService = new YoutubeService();
            tubeService.setPage(1);
            tubeService.setLimit(49);
            List<Tube> listToAdd = new ArrayList<Tube>();
            tubeService.searchByChannel(channelId, true);
            for (Tube tube : tubeService.getListResult()) {
              tube.setPlaylistId(playlistId);
              listToAdd.add(tube);
            }
            TubeModel.insert(listToAdd);
            mission.setId(IdUniqueHelper.getId());
            mission.setSearchHd(1);
            mission.setSearchType(1);
            mission.setSearchKeyword(channelId);
            mission.setPlaylistId(playlistId);
            mission.setSearchLimit(tubeService.getLimit());
            if (tubeService.getListResult().size() > 0
                && !tubeService.isTooManyRecentCallError()) {
              mission.setSearchPage(tubeService.getPage() + 1);
            } else {
              mission.setSearchPage(tubeService.getPage());
            }
            mission.setSearchTotalPage(tubeService.getTotalPage());
            mission.setType(2);
            mission.setTitle("Get videos from channel " + channelId
                + " to playlist " + pl.getTitle());
            MissionModel.insert(mission);
            session.setAttribute("success", "Action success !");
            resp.sendRedirect("/admin/mission/add");
          } else if (type.equals("1")) {
            mission.setId(IdUniqueHelper.getId());
View Full Code Here


  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      Playlist pl = PlaylistModel.byId(id, false);
      if (pl != null) {
        session.setAttribute("action", "edit");
        session.setAttribute("pl", pl);
        req.getRequestDispatcher("/admin/form_playlist.jsp").forward(
            req, resp);
View Full Code Here

  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      Playlist pl = PlaylistModel.byId(id, false);
      if (pl != null) {
        if (PlaylistValidate
            .checkForm(req, resp, session, "edit", pl)) {
          pl.setUpdated(Calendar.getInstance().getTime());
          PlaylistModel.insert(pl);
          session.setAttribute("action", "add");
          session.setAttribute("success", "Action success !");
          resp.sendRedirect("/admin/playlist/edit?id=" + id);
        }
View Full Code Here

      try {
        page = Integer.parseInt((String) req.getParameter("page"));
      } catch (Exception e) {
        page = 1;
      }
      Playlist obj = PlaylistModel.byId(id, true);
      if (obj != null) {
        TubeSearchModel model = new TubeSearchModel();
        model.setPage(page);
        model.prepareTubeByPlaylist(obj.getId());
        req.setAttribute("model", model);
        req.setAttribute("obj", obj);
        req.setAttribute("url", req.getRequestURL().toString());
        req.getRequestDispatcher("/playlist.jsp").forward(req, resp);
      } else {
View Full Code Here

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      HttpSession session = req.getSession();
      if (session.getAttribute("return") == null) {
        Playlist pl = new Playlist();
        session.setAttribute("pl", pl);
      }     
      session.setAttribute("action", "add");
      req.getRequestDispatcher("/admin/form_playlist.jsp").forward(req,
          resp);
View Full Code Here

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      HttpSession session = req.getSession();
      Playlist pl = new Playlist();
      if (PlaylistValidate.checkForm(req, resp, session, "add", pl)) {
        pl.setId(IdUniqueHelper.getId());
        PlaylistModel.insert(pl);
        session.removeAttribute("pl");
        session.setAttribute("action", "add");
        session.setAttribute("success", "Action success !");
        resp.sendRedirect("/admin/playlist/add");
View Full Code Here

  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    String action = request.getParameter("action");
    if (action != null && action.equals("delete")) {
      String id = request.getParameter("id");
      Playlist pl = PlaylistModel.byId(id, false);
      if (pl != null) {
        PlaylistModel.delete(pl);       
      }
    } else if (action != null && action.equals("bump")) {
      String id = request.getParameter("id");
      Playlist pl = PlaylistModel.byId(id, false);
      if (pl != null) {
        pl.setIndexDate(Calendar.getInstance().getTime());
        PlaylistModel.insert(pl);
      }
    }
  }
View Full Code Here

        String playlistId = (String) req.getParameter("playlist");
        url = (String) req.getParameter("url");
        url = URLDecoder.decode(url, "UTF-8");

        Tube tube = YoutubeService.searchStaticById(id);
        Playlist pl = PlaylistModel.byId(playlistId, false);
        TreeMap recentAddTreeId = (TreeMap) session
            .getAttribute("recentAddTreeId");
        String currentPl = (String) session
            .getAttribute("currentPlaylist");
        if (currentPl != null && !currentPl.equals(pl.getId())) {
          recentAddTreeId = new TreeMap();
        } else if (recentAddTreeId == null) {
          recentAddTreeId = new TreeMap();
        }
        if (pl != null
            && TubeValidate.checkForm(req, resp, session, action,
                tube)) {
          tube = processTubeDetail(playlistId, tube);
          // add author to site.
          Queue queue = QueueFactory.getDefaultQueue();
          queue.add(TaskOptions.Builder.withUrl(
              "/task-admin?action=add-author&uri="
                  + tube.getAuthorUrl()).method(
              TaskOptions.Method.GET));
          TubeModel.insert(tube);
          recentAddTreeId.put(tube.getId(), tube.getId());
          session.setAttribute("recentAddTreeId", recentAddTreeId);
          session.setAttribute("currentPlaylist", pl.getId());
          session.setAttribute("success",
              "Action success ! Video have been added to playlist \""
                  + pl.getTitle() + "\"");
        } else {
          log.warning("A2");
          session.setAttribute("error",
              "Action fails ! Please try again later !");
View Full Code Here

  private String getAllFromChannel(HttpSession session,
      HttpServletRequest request) {
    String channelId = (String) request.getParameter("channel");
    String playlistId = (String) request.getParameter("playlistId");
    String subcribe = (String) request.getParameter("subcribe");
    Playlist pl = PlaylistModel.byId(playlistId, false);
    if (channelId != null && channelId.length() > 0 && pl != null) {
      Queue queue = QueueFactory.getDefaultQueue();
      queue.add(TaskOptions.Builder.withUrl(
          "/task-admin?action=add-all-from-channel&channelId="
              + channelId + "&playlistId=" + playlistId
View Full Code Here

  private boolean addAllVideosToCategory(HttpSession session,
      HttpServletRequest request) {
    try {
      String strIds = (String) request.getParameter("ids");
      String plId = (String) request.getParameter("plId");
      Playlist pl = PlaylistModel.byId(plId, false);
      if (pl != null) {
        List<Tube> list = new ArrayList<Tube>();
        String[] ids = strIds.split(",");
        TreeMap recentAddTreeId = (TreeMap) session
            .getAttribute("recentAddTreeId");
        String currentPl = (String) session
            .getAttribute("currentPlaylist");
        if (currentPl != null && !currentPl.equals(plId)) {
          recentAddTreeId = new TreeMap();
        } else if (recentAddTreeId == null) {
          recentAddTreeId = new TreeMap();
        }
        Queue queue = QueueFactory.getDefaultQueue();
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].isEmpty()) {
            Tube tube = YoutubeService.searchStaticById(ids[i]);
            if (tube != null) {
              tube = processTubeDetail(plId, tube);
              recentAddTreeId.put(ids[i], ids[i]);
              list.add(tube);
              // add author to site.
              queue.add(TaskOptions.Builder.withUrl(
                  "/task-admin?action=add-author&uri="
                      + tube.getAuthorUrl()).method(
                  TaskOptions.Method.GET));
            }
          }
        }
        TubeModel.insert(list);
        session.setAttribute("recentAddTreeId", recentAddTreeId);
        session.setAttribute("currentPlaylist", pl.getId());
        return true;
      } else {
        return false;
      }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.Playlist

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.