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; }
/** @deprecated */ public static int getPrimaryFileIndex(Download dl) { EnhancedDownloadManager edm = DownloadManagerEnhancer.getSingleton().getEnhancedDownload(PluginCoreUtils.unwrap(dl)); if (edm == null) { return -1; } return edm.getPrimaryFileIndex(); }
public static boolean prepareForPlay(DownloadManager dm) { EnhancedDownloadManager edm = DownloadManagerEnhancer.getSingleton().getEnhancedDownload(dm); if (edm != null) { edm.setProgressiveMode(true); return (true); } return (false); }