Methods Summary |
---|
public com.aelitis.azureus.plugins.extseed.ExternalSeedReader[] | getSeedReaders(com.aelitis.azureus.plugins.extseed.ExternalSeedPlugin plugin, org.gudy.azureus2.plugins.download.Download download)
Torrent torrent = download.getTorrent();
try{
Map config = new HashMap();
Object obj = torrent.getAdditionalProperty( "httpseeds" );
if ( obj != null ){
config.put( "httpseeds", obj );
}
return( getSeedReaders( plugin, download, config ));
}catch( Throwable e ){
e.printStackTrace();
}
return( new ExternalSeedReader[0] );
|
public com.aelitis.azureus.plugins.extseed.ExternalSeedReader[] | getSeedReaders(com.aelitis.azureus.plugins.extseed.ExternalSeedPlugin plugin, org.gudy.azureus2.plugins.download.Download download, java.util.Map config)
Torrent torrent = download.getTorrent();
try{
Object obj = config.get( "httpseeds" );
if ( obj instanceof List ){
List urls = (List)obj;
List readers = new ArrayList();
Object _params = config.get( "httpseeds-params" );
Map params = _params instanceof Map?(Map)_params:new HashMap();
for (int i=0;i<urls.size();i++){
try{
URL url = new URL(new String((byte[])urls.get(i)));
String protocol = url.getProtocol().toLowerCase();
if ( protocol.equals( "http" )){
readers.add( new ExternalSeedReaderWebSeed( plugin, torrent, url, params ));
}else{
plugin.log( download.getName() + ": WS unsupported protocol: " + url );
}
}catch( Throwable e ){
e.printStackTrace();
}
}
ExternalSeedReader[] res = new ExternalSeedReader[ readers.size() ];
readers.toArray( res );
return( res );
}
}catch( Throwable e ){
e.printStackTrace();
}
return( new ExternalSeedReader[0] );
|
public static void | main(java.lang.String[] args)
try{
File file = new File ( "C:\\temp\\test.torrent");
TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedFile( file );
Map map = torrent.serialiseToMap();
List urls = new ArrayList();
urls.add( "http://192.168.1.2:8080/test.dat" );
map.put( "httpseeds", urls);
torrent = TOTorrentFactory.deserialiseFromMap( map );
torrent.serialiseToBEncodedFile( file );
}catch( Throwable e ){
e.printStackTrace();
}
|