Package devplugin

Examples of devplugin.Date


       
        mProgramVector = new Vector<Program>();

        Channel[] channels = Plugin.getPluginManager().getSubscribedChannels();

        Date date = new Date();
        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) && (program.getTitle() != null) && (program.getTitle().equalsIgnoreCase(mTitle))) {
                      mProgramVector.add(program);
                  }
              }
            }
            date = date.addDays(1);
        }

    }
View Full Code Here


    Logger.getLogger("sun.awt.X11.timeoutTask.XToolkit").setLevel(Level.INFO);
    mDataSource = config.getDataSource();
    mDataTarget = config.getDataTarget();
    mPrimaryServerUrl = config.getPrimaryServerUrl();
    mChannelGroupArr=config.getChannelgroups();
    mDeadlineDay = new Date().addDays(-2);
  }
View Full Code Here

  {
    try {
      int year = Integer.parseInt(fileName.substring(0, 4));
      int month = Integer.parseInt(fileName.substring(5, 7));
      int day = Integer.parseInt(fileName.substring(8, 10));
      Date date = new Date(year, month, day);
     
      return date.compareTo(mDeadlineDay) >= 0;
    }
    catch (Exception exc) {
      throw new UpdateException("Day program file name has wrong pattern: "
        + fileName, exc);
    }
View Full Code Here


  public void updateDayProgramsFor(Channel channel, String level)
    throws UpdateException
  {
    Date date = new Date().addDays(-1);
    int daysWithNoData = 0;
   
    while (daysWithNoData < MAX_DAYS_WITHOUT_DATA) {
      String completeFileName = DayProgramFile.getProgramFileName(date,
        channel.getCountry(), channel.getId(), level);
       
      // Check which version is on the source
      // version -1 means there is no version
      int versionAtSource = -1;
      if (mDataSource.fileExists(completeFileName)) {
        versionAtSource = 1;
        boolean finished = false;
        do {
          String updateFileName = DayProgramFile.getProgramFileName(date,
            channel.getCountry(), channel.getId(), level, versionAtSource);
          if (mDataSource.fileExists(updateFileName)) {
            // There is an update file for the current version
            // -> The version of the complete file must be at least one higher
            versionAtSource++;
          } else {
            finished = true;
          }
        } while (! finished);
      }
     
      if (versionAtSource == -1) {
        daysWithNoData++;
      } else {
        daysWithNoData = 0;
       
        // Check which version is on the mirror
        // version -1 means there is no version
        int versionOnMirror = -1;
        if (fileIsOnMirror(completeFileName)) {
          versionOnMirror = 1;
          boolean finished = false;
          do {
            String updateFileName = DayProgramFile.getProgramFileName(date,
              channel.getCountry(), channel.getId(), level, versionOnMirror);
            if (fileIsOnMirror(updateFileName)) {
              // There is an update file for the current version
              // -> The version of the complete file must be at least one higher
              versionOnMirror++;
            } else {
              finished = true;
            }
          } while (! finished);
        }
       
        // Check whether the mirror needs an update
        if (versionOnMirror < versionAtSource) {
          String additionalFileName = null;
          if (versionOnMirror == -1) {
            mLog.fine("Adding version " + versionAtSource
              + ": " + completeFileName);
          } else {
            mLog.fine("Updating from version "
              + versionOnMirror + " to " + versionAtSource
              + ": " + completeFileName);
          }
         
         
          int index = completeFileName.indexOf("_update_");
           
          if(index != -1) {
            additionalFileName = completeFileName.substring(0,index) + completeFileName.substring(index+8,completeFileName.indexOf(".prog.gz")) + "_additional.prog.gz";
          } else {
            additionalFileName = completeFileName.substring(0,completeFileName.indexOf(".prog.gz")) + "_additional.prog.gz";
          }

          mLog.log(Level.INFO, "Checking for old additional file: " + additionalFileName);
          for(String value : mTargetFileArr) {
            if(value.compareTo(additionalFileName) == 0) {
              mLog.fine("Deleting old additional file: " + additionalFileName);
              mDataTarget.deleteFile(additionalFileName);
              break;
            }
          }

          if(mDataSource.fileExists(additionalFileName)) {
            mLog.fine("Adding new additional file: " + additionalFileName);
            byte[] data = mDataSource.loadFile(additionalFileName);
            mDataTarget.writeFile(additionalFileName, data);
          }
                     
         
          // Update the mirror
          byte[] data = mDataSource.loadFile(completeFileName);
          mDataTarget.writeFile(completeFileName, data);
         
          for (int version = 0; version < versionAtSource; version++) {
            String updateFileName = DayProgramFile.getProgramFileName(date,
              channel.getCountry(), channel.getId(), level, version);

            data = mDataSource.loadFile(updateFileName);
            mDataTarget.writeFile(updateFileName, data);
          }
        } else {
          mLog.fine("File already up to date (version " + versionOnMirror + "): "
            + completeFileName);
        }
      }
     
      // Go on with the next day
      date = date.addDays(1);
    }
  }
View Full Code Here

  private Hashtable<String, Program> createUpdateList() {
    Hashtable<String, Program> table = new Hashtable<String, Program>();

    Channel[] channels = Plugin.getPluginManager().getSubscribedChannels();

    Date date = new Date();
    date = date.addDays(-1);
    for (int d = 0; d < 32; d++) {
      for (Channel channel : channels) {
        for (Iterator<Program> it = Plugin.getPluginManager().getChannelDayProgram(date, channel); it.hasNext();) {
          Program program = it.next();
          if ((program != null) && mPlugin.isProgramRateable(program)) {
            if (!table.containsKey(program.getTitle())) {
              table.put(program.getTitle(), program);
            }
          }
        }
      }

      date = date.addDays(1);
    }

    return table;
  }
View Full Code Here

        try {
            int channel = Integer.parseInt(result[i]);

            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

    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    Program[] progs = mRootNode.getPrograms();

    Arrays.sort(progs, ProgramUtilities.getProgramComparator());
    Date curDate=null;

    for (int i=0; i<progs.length; i++) {
      if (!progs[i].getDate().equals(curDate)) {
        curDate = progs[i].getDate();
        JPanel datePanel = new JPanel(new BorderLayout());
        JLabel dateLb = new JLabel(curDate.getLongDateString());
        dateLb.setFont(new Font("Dialog", Font.ITALIC, 14));
        datePanel.add(dateLb, BorderLayout.WEST);
        content.add(datePanel);
      }
      addProgramPanel(content, progs[i]);
View Full Code Here

        }
      }

      mDayProgram.setLastProgramHadEndOnUpdate(dataFile.readBoolean());

      Date date = Date.readData(dataFile);
      Channel channel = Channel.readData(dataFile, false);

      boolean timeLimited = channel.isTimeLimited();
      int startTimeLimit = channel.getStartTimeLimit();
      int endTimeLimit = channel.getEndTimeLimit();
View Full Code Here

  public void mouseEntered(final MouseEvent arg0) {
  }

  public void updateContent() {
    Date date = Date.getCurrentDate();
    if (date.equals(mToday)) {
      return;
    }

    mToday = date;
    rebuildControls();
View Full Code Here

      stream = new BufferedInputStream(new FileInputStream(mFile), 0x10000);
      ObjectInputStream objIn = new ObjectInputStream(stream);

      objIn.readInt();

      Date date = Date.readData(objIn);
      Channel channel = Channel.readData(objIn, false);

      int size = objIn.readInt();
      mDayProgram.removeAllPrograms();
      for (int i = 0; i < size; i++) {
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.