Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Limiting download and upload speed using Vuze API
#1
Hello,

I'm trying to code a java program using vuze api in order to implement a few experiments. The download works fine using this code :



Code:
String url = "500mega.torrent";
core = AzureusCoreFactory.create();
core.start();
File downloadedTorrentFile = new File(url);
System.out.println("Completed download of : " + url);
System.out.println("File stored as : "
+ downloadedTorrentFile.getAbsolutePath());
File downloadDirectory = new File("downloads"); // Destination directory
if (downloadDirectory.exists() == false)
downloadDirectory.mkdir();
COConfigurationManager.initialise();
GlobalManager globalManager = core.getGlobalManager();
DownloadManager manager = globalManager.addDownloadManager(
downloadedTorrentFile.getAbsolutePath(),
downloadDirectory.getAbsolutePath());
DownloadManagerListener listener = new DownloadStateListener();
manager.addListener(listener);

TransferSpeedValidator.setGlobalDownloadRateLimitBytesPerSecond(100);
System.out.println(TransferSpeedValidator
.getGlobalDownloadRateLimitBytesPerSecond());
globalManager.startAllDownloads();



However, I can't find the method to limit the upload/download speed. The API documentation is not well detailed in Vuze...
Any help would be much appreciated.
Reply
#2
Normally you would use the 'plugin' interface's methods to interact with Vuze - here's an example of how to start Vuze and then do something once it is initialized:


Code:
Properties props = new Properties();

File az_dir = new File( "C:\\temp\\aztest" );

props.put( PluginManager.PR_APP_DIRECTORY, az_dir.getAbsolutePath());
props.put( PluginManager.PR_USER_DIRECTORY, az_dir.getAbsolutePath());

File doc_dir = new File( "C:\\temp\\aztest\\data" );

props.put( PluginManager.PR_DOC_DIRECTORY, doc_dir.getAbsolutePath());


PluginManager pm = PluginManager.startAzureus( 
PluginManager.UI_NONE,
props );

final PluginInterface pi = pm.getDefaultPluginInterface();

pi.addListener(
new PluginListener()
{
public void
initializationComplete()
{
Download downloads = pi.getDownloadManager().getDownloads();

for ( Download d: downloads ){

System.out.println( "Download: " + d.getName());
}
}

public void
closedownInitiated()
{

}

public void
closedownComplete()
{

}
});

The 'default plugin interface' has a 'getPluginconfig' method that returns a PluginConfig object that supports setting max up/down speeds etc
Reply
#3
See http://wiki.vuze.com/w/Plugin_class_impl...ng_Azureus
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  plugin api kader 0 558 03-12-2016, 12:00 AM
Last Post: kader
  Plugin API: documentation and download problems warp-9.9 0 497 02-10-2016, 11:59 AM
Last Post: warp-9.9



Users browsing this thread: 1 Guest(s)