Exemplo n.º 1
0
  public static boolean canProgressiveOrIsComplete(TOTorrent torrent) {
    if (torrent == null) {
      return false;
    }
    try {
      DownloadManagerEnhancer enhancer = DownloadManagerEnhancer.getSingleton();
      EnhancedDownloadManager edm =
          DownloadManagerEnhancer.getSingleton().getEnhancedDownload(torrent.getHash());

      if (edm == null) {
        return enhancer.isProgressiveAvailable()
            && PlatformTorrentUtils.isContentProgressive(torrent);
      }

      boolean complete = edm.getDownloadManager().isDownloadComplete(false);
      if (complete) {
        return true;
      }

      // not complete
      if (!edm.supportsProgressiveMode()) {
        return false;
      }
    } catch (TOTorrentException e) {
      return false;
    }

    return true;
  }
Exemplo n.º 2
0
  /** @deprecated */
  public static int getPrimaryFileIndex(Download dl) {
    EnhancedDownloadManager edm =
        DownloadManagerEnhancer.getSingleton().getEnhancedDownload(PluginCoreUtils.unwrap(dl));

    if (edm == null) {

      return -1;
    }

    return edm.getPrimaryFileIndex();
  }
Exemplo n.º 3
0
  public static boolean prepareForPlay(DownloadManager dm) {
    EnhancedDownloadManager edm = DownloadManagerEnhancer.getSingleton().getEnhancedDownload(dm);

    if (edm != null) {

      edm.setProgressiveMode(true);

      return (true);
    }

    return (false);
  }