Search in sources :

Example 1 with DownloadWillBeAddedListener

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);
            }
        }
    });
}
Also used : DownloadWillBeAddedListener(com.biglybt.pif.download.DownloadWillBeAddedListener) PluginInterface(com.biglybt.pif.PluginInterface) DownloadManager(com.biglybt.pif.download.DownloadManager) Download(com.biglybt.pif.download.Download)

Aggregations

PluginInterface (com.biglybt.pif.PluginInterface)1 Download (com.biglybt.pif.download.Download)1 DownloadManager (com.biglybt.pif.download.DownloadManager)1 DownloadWillBeAddedListener (com.biglybt.pif.download.DownloadWillBeAddedListener)1