use of com.biglybt.pif.download.DownloadWillBeAddedListener in project BiglyBT by BiglySoftware.
the class InitialisationFunctions method hookDownloadAddition.
protected static void hookDownloadAddition() {
PluginInterface pi = PluginInitializer.getDefaultInterface();
DownloadManager dm = pi.getDownloadManager();
// need to get in early to ensure property present on initial announce
dm.addDownloadWillBeAddedListener(new DownloadWillBeAddedListener() {
@Override
public void initialised(Download download) {
// unfortunately the has-been-opened state is updated by the client when a user opens content
// but is also preserved across torrent export/import (e.g. when downloaded via magnet
// URL. So reset it here if it is found to be set
com.biglybt.core.download.DownloadManager dm = PluginCoreUtils.unwrap(download);
if (PlatformTorrentUtils.getHasBeenOpened(dm)) {
PlatformTorrentUtils.setHasBeenOpened(dm, false);
}
}
});
}
Aggregations