Package devplugin

Examples of devplugin.Date


  private static PageModel[] createPages(DayProgramPrinterSettings settings) {

    ArrayList<PageModel> pageModelList = new ArrayList<PageModel>();
    int dayCount = settings.getNumberOfDays();
    Date startDate = settings.getFromDay();
    int dayStartHour = settings.getDayStartHour();
    int dayEndHour = settings.getDayEndHour();

    Channel[] channelArr = settings.getChannelList();
    if (channelArr == null) {
      channelArr = Plugin.getPluginManager().getSubscribedChannels();
    }
    for (int dateInx=0;dateInx<dayCount;dateInx++) {
      Date date=startDate.addDays(dateInx);
      DefaultPageModel pageModel = new DefaultPageModel(date.getLongDateString());
      pageModelList.add(pageModel);
      for (Channel element : channelArr) {
        ArrayList<Program> progList = new ArrayList<Program>();
        addProgramToList(progList, date, element, dayStartHour, dayEndHour, settings.getProgramFilter());
        Program[] progArr=new Program[progList.size()];
View Full Code Here


                String id = result[i + 4].replace(',', '.');
                String title = result[i + 5].trim();

                String[] dateStr = result[i + 1].split("-");

                Date date = new Date(Integer.parseInt(dateStr[0]), Integer
                        .parseInt(dateStr[1]), Integer.parseInt(dateStr[2]));

                String[] hourStr = result[i + 2].split(":");

                int hour = Integer.parseInt(hourStr[0]);
View Full Code Here

      Channel channel = program.getChannel();
      if (channel == null) {
        return false;
      }

      Date date = program.getDate();
      if (date == null) {
        return false;
      }

      Program last = null;
View Full Code Here

  public void updateCurrentDate() {
    // dont update the UI if the rating updater runs on TV-Browser start
    if (!mStartFinished) {
      return;
    }
    Date currentDate = getPluginManager().getCurrentDate();
    final Channel[] channels = getPluginManager().getSubscribedChannels();
    for (Channel channel : channels) {
      for (Iterator<Program> iter = getPluginManager().getChannelDayProgram(currentDate, channel); iter.hasNext();) {
        Program prog = iter.next();
        if (getRating(prog) != null) {
View Full Code Here

      addTitle(titles, listEntitlement, rating, rating.getEntitlementRating());
    }

    // now find the programs which match the previously collected titles
    Channel[] channels = Plugin.getPluginManager().getSubscribedChannels();
    Date date = Date.getCurrentDate();
    for (int d = 0; d < 31; d++) {
      for (Channel channel : channels) {
        for (Iterator<Program> it = Plugin.getPluginManager().getChannelDayProgram(date, channel); it.hasNext();) {
          Program program = it.next();
          if (program != null) {
            String title = program.getTitle();
            if (title != null) {
              HashSet<PluginTreeNode> nodes = titles.get(title);
              if (nodes != null) {
                for (PluginTreeNode titleNode : nodes) {
                  titleNode.addProgramWithoutCheck(program);
                }
              }
            }
          }
        }
      }
      date = date.addDays(1);
    }

    // now add the title nodes to the plugin tree
    PluginTreeNode topOverall = mRootNode.addNode(mLocalizer.msg("topOverall", "Top programs"));
    PluginTreeNode topAction = mRootNode.addNode(mLocalizer.msg("topAction", "Top action"));
View Full Code Here

  }

  private static boolean mirrorIsUpToDate(Mirror mirror, String id) throws TvBrowserException {
    // Load the lastupdate file and parse it
    final String url = mirror.getUrl() + (mirror.getUrl().endsWith("/") ? "" : "/") + id + "_lastupdate";
    Date lastupdated;
    mMirrorDownloadRunning = true;
    mMirrorDownloadData = null;
    mDownloadException = false;

    mLog.info("Loading MirrorDate from " + url);

    new Thread(new Runnable() {
      public void run() {
        try {
          mMirrorDownloadData = IOUtilities.loadFileFromHttpServer(new URL(url), 60000);
        } catch (Exception e) {
          mDownloadException = true;
        }
        mMirrorDownloadRunning = false;
      };
    }, "Load mirror date from "+url).start();

    int num = 0;
    // Wait till second Thread is finished or 15000 ms reached
    while ((mMirrorDownloadRunning) && (num < 150)) {
      num++;
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }

    if (mMirrorDownloadRunning || mMirrorDownloadData == null || mDownloadException) {
      mLog.info("Server " + url +" is down!");
      return false;
    }

    try {
      // Parse is. E.g.: '2003-10-09 11:48:45'
      String asString = new String(mMirrorDownloadData);

      if (asString.length() > 10) {
        int year = Integer.parseInt(asString.substring(0, 4));
        int month = Integer.parseInt(asString.substring(5, 7));
        int day = Integer.parseInt(asString.substring(8, 10));
        lastupdated = new Date(year, month, day);

        mLog.info("Done !");

        return lastupdated.compareTo(new Date().addDays(-MAX_LAST_UPDATE_DAYS)) >= 0;
      }
    }catch(NumberFormatException parseException) {
      mLog.info("The file on the server has the wrong format!");
    }
View Full Code Here

   
    mProgramList = new ProgramList(model);
    mProgramList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    mProgramList.setSelectionModel(m);
   
    Date programDate = p.getDate();
    Channel programChannel = p.getChannel();
   
    Iterator<Program> channelDayProgram = Plugin.getPluginManager().getChannelDayProgram(programDate,programChannel);
   
    while(channelDayProgram.hasNext() && model.size() <= additionalProgramCount) {
      Program prog = channelDayProgram.next();
     
      if((prog.equals(p) || (!model.isEmpty() && model.size() <= additionalProgramCount)) /*&& prog.getLength() > 0*/) {
        model.addElement(prog);
      }
    }
   
    if(model.size() <= additionalProgramCount) {
      programDate = programDate.addDays(1);
      channelDayProgram = Plugin.getPluginManager().getChannelDayProgram(programDate, programChannel);
     
      if(channelDayProgram != null) {
        while(channelDayProgram.hasNext() && model.size() <= additionalProgramCount) {
          Program prog = channelDayProgram.next();
View Full Code Here

      SimpleMarkerPlugin.getInstance().addList(this);

      int size = in.readInt();
      mProgramItems.ensureCapacity(size);
      for (int i = 0; i < size; i++) {
        Date programDate = Date.readData(in);
        String progId = (String) in.readObject();
        mProgramItems.add(new MarkListProgramItem(programDate, progId));

//        Program program = Plugin.getPluginManager().getProgram(programDate,
//            progId);
View Full Code Here

        }

        root.removeAllActions();
        root.addAction(getUnmarkAction(root));

        final Date currentDate = Date.getCurrentDate();
        for (Entry<String, LinkedList<Program>> entry : sortedPrograms.entrySet()) {
          String name = entry.getKey();
          LinkedList<Program> sameTitlePrograms = entry.getValue();

          PluginTreeNode titleNode = null;
          if (settings.isGroupingByBoth()) {
            titleNode = programRoot.addNode(name);
          } else if (settings.isGroupingByTitle()) {
            titleNode = root.addNode(name);
          }
          if (titleNode != null) {
            titleNode.addAction(getUnmarkAction(titleNode));
            titleNode.setGroupingByDateEnabled(false);
          }

          for (Program program : sameTitlePrograms) {
            if (titleNode != null) {
              PluginTreeNode prog = titleNode.addProgram(program);
              prog.setNodeFormatter(new NodeFormatter() {
                public String format(ProgramItem pitem) {
                  Program p = pitem.getProgram();
                  Date progDate = p.getDate();
                  String progDateText;

                  if (progDate.equals(currentDate.addDays(-1))) {
                    progDateText = Localizer
                        .getLocalization(Localizer.I18N_YESTERDAY);
                  } else if (progDate.equals(currentDate)) {
                    progDateText = Localizer.getLocalization(Localizer.I18N_TODAY);
                  } else if (progDate.equals(currentDate.addDays(1))) {
                    progDateText = Localizer.getLocalization(Localizer.I18N_TOMORROW);
                  } else {
                    progDateText = p.getDateString();
                  }
View Full Code Here

      for (File file : fileArr) {
        String fileName = file.getName();
        if (fileName.endsWith("_full.prog.gz")) {
          // This is a complete file -> Put its version to the summary
          try {
            Date date = DayProgramFile.getDateFromFileName(fileName);
            String country = DayProgramFile.getCountryFromFileName(fileName);
            String channelId = DayProgramFile.getChannelNameFromFileName(fileName);
            String levelName = DayProgramFile.getLevelFromFileName(fileName);

            //if (channelBelongsToGroup(channelId, country)) {
View Full Code Here

TOP

Related Classes of devplugin.Date

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.