예제 #1
0
 private void applyPriority(final FrostDownloadItem dlItem, final FcpPersistentGet getReq) {
   // apply externally changed priority
   if (dlItem.getPriority() != getReq.getPriority()) {
     if (Core.frostSettings.getBoolValue(SettingsClass.FCP2_ENFORCE_FROST_PRIO_FILE_DOWNLOAD)) {
       // reset priority with our current value
       fcpTools.changeRequestPriority(getReq.getIdentifier(), dlItem.getPriority());
     } else {
       // apply to downloaditem
       dlItem.setPriority(getReq.getPriority());
     }
   }
 }
예제 #2
0
  public boolean startDownload(final FrostDownloadItem dlItem) {

    if (dlItem == null || dlItem.getState() != FrostDownloadItem.STATE_WAITING) {
      return false;
    }

    dlItem.setDownloadStartedTime(System.currentTimeMillis());

    dlItem.setState(FrostDownloadItem.STATE_PROGRESS);

    final String gqid = dlItem.getGqIdentifier();
    final File targetFile = new File(dlItem.getDownloadFilename());
    boolean isDda =
        fcpTools.startPersistentGet(dlItem.getKey(), gqid, targetFile, dlItem.getPriority());
    dlItem.setDirect(!isDda);

    return true;
  }