示例#1
0
 private static File getIncompleteFolder() {
   File incompleteFolder =
       new File(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue().getParentFile(), "Incomplete");
   if (!incompleteFolder.exists()) {
     incompleteFolder.mkdirs();
   }
   return incompleteFolder;
 }
    @Override
    public boolean isPathEditable(TreePath path) {
      Object comp = path.getLastPathComponent();
      if (comp instanceof File) {
        if (comp.equals(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue())) {
          return false;
        }
      }

      // root node is not editable
      return path.getPathCount() != 1;
    }
    public boolean accept(File pathname) {
      if (FileUtils.isAncestor(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue(), pathname)) {
        return false;
      }

      for (File f : LibrarySettings.DIRECTORIES_TO_INCLUDE_FROM_FROSTWIRE4.getValue()) {
        if (FileUtils.isAncestor(f, pathname)) {
          return false;
        }
      }

      if (FileUtils.isAncestor(LibrarySettings.USER_MUSIC_FOLDER.getValue(), pathname)) {
        return false;
      }

      return pathname.isDirectory() && !pathname.isHidden();
    }
示例#4
0
  public SoundcloudDownload(SoundcloudSearchResult sr) {
    this.sr = sr;
    this.size = sr.getSize();

    String filename = sr.getFilename();

    completeFile = buildFile(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue(), filename);
    tempAudio = buildTempFile(FilenameUtils.getBaseName(filename), "mp3");

    bytesReceived = 0;
    dateCreated = new Date();

    httpClientListener = new HttpDownloadListenerImpl();

    httpClient = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.DOWNLOAD);
    httpClient.setListener(httpClientListener);

    start();
  }