コード例 #1
0
ファイル: PlayUtils.java プロジェクト: nuclearrussian/LPS
  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;
  }