public static void torrent_getter(final String url, final PluginInterface pluginInterface){
try{
//String url_enc = URLEncoder.encode(url,"UTF-8");
ResourceDownloaderFactory rdf;
URL url_get = new URL (url);
final URL url_final;
rdf = pluginInterface.getUtilities().getResourceDownloaderFactory();
System.out.println("Downloader: " + url_get.getHost());
System.out.println("Downloader: " + url_get.getFile());
if(url_get.getFile().startsWith("/announce")){
url_final = new URL("http", url_get.getHost(),url_get.getPort(),"/" + url_get.getFile().substring(9,url_get.getFile().length()));
System.out.println(url_final.getFile());
}
else {
url_final = new URL(url);
}
//normal resource downloader
ResourceDownloader rd_t = rdf.create(url_final);
//rd_t = rdf.getRetryDownloader(rd_t, 3);
rd_t = rdf.getTimeoutDownloader(rd_t,1200000);
rd_t = rdf.getMetaRefreshDownloader(rd_t);
//rd_t = rdf.getTorrentDownloader(rd_t,true);
//Listener for rd_t
rd_t.addListener(new ResourceDownloaderListener()