Package org.gudy.azureus2.plugins.torrent

Examples of org.gudy.azureus2.plugins.torrent.Torrent


 
  public void
  downloadAdded(
    Download  download )
  {
    Torrent  torrent = download.getTorrent();
   
    if ( torrent == null ){
     
      return;
    }
View Full Code Here


  public List<ExternalSeedPeer>
  addSeed(
    Download  download,
    Map      config )
  {
    Torrent  torrent = download.getTorrent();
   
    List<ExternalSeedPeer>  peers = new ArrayList<ExternalSeedPeer>();
    
    if ( torrent != null ){
           
View Full Code Here

     
        //OK lets start the test.
        try{
            TorrentUtils.setFlag( tot, TorrentUtils.TORRENT_FLAG_LOW_NOISE, true );
           
            Torrent torrent = new TorrentImpl(tot);
            String fileName = torrent.getName();

            sendStageUpdateToListeners(MessageText.getString("SpeedTestWizard.stage.message.preparing"));
             
            //create a blank file of specified size. (using the temporary name.)
            File saveLocation = AETemporaryFileHandler.createTempFile();
            File baseDir = saveLocation.getParentFile();
            File blankFile = new File(baseDir,fileName);
            File blankTorrentFile = new File( baseDir, "speedTestTorrent.torrent" );
            torrent.writeToFile(blankTorrentFile);

            URL  announce_url = torrent.getAnnounceURL();
           
            if ( announce_url.getProtocol().equalsIgnoreCase( "https" )){
             
              SESecurityManager.setCertificateHandler(
                  announce_url,
View Full Code Here

 
  public void
  downloadAdded(
    Download  download )
  {
    Torrent torrent = download.getTorrent();
   
    if ( torrent != null && PlatformTorrentUtils.isContent( torrent, false )){
               
      addDynamicXCode( download.getDiskManagerFileInfo()[0]);
    }
View Full Code Here

 
  public void
  downloadRemoved(
    Download  download )
  {
    Torrent torrent = download.getTorrent();
   
    if ( torrent != null && PlatformTorrentUtils.isContent( torrent, false )){
               
      removeDynamicXCode( download.getDiskManagerFileInfo()[0]);
    }
View Full Code Here

                 String  thumb_url    = null;
                String  author      = null;
                String  description    = null;
               
                try{
                  Torrent torrent = file.getSourceFile().getDownload().getTorrent();
               
                  TOTorrent toTorrent = PluginCoreUtils.unwrap(torrent);
             
                  long duration_secs = PlatformTorrentUtils.getContentVideoRunningTime(toTorrent);
                 
View Full Code Here

      try{
        Download d = to_info.getRelatedToDownload();
     
        if ( d != null ){
         
          Torrent torrent = d.getTorrent();
         
          if ( torrent != null ){
           
            long cnet = PlatformTorrentUtils.getContentNetworkID( PluginCoreUtils.unwrap( torrent ));
           
            if ( cnet != ContentNetwork.CONTENT_NETWORK_UNKNOWN ){
             
              map.put( "c", new Long( cnet ));
            }
           
            long secs = torrent.getCreationDate();
           
            long hours = secs/(60*60);
           
            if ( hours > 0 ){
             
View Full Code Here

                 
                  ResourceDownloader mr_rd = rdf.getMetaRefreshDownloader( url_rd );
   
                  InputStream is = mr_rd.download();
   
                  Torrent torrent = new TorrentImpl( TOTorrentFactory.deserialiseFromBEncodedInputStream( is ));
                           
                  // PlatformTorrentUtils.setContentTitle(torrent, torr );
             
                  DownloadManager dm = PluginInitializer.getDefaultInterface().getDownloadManager();
                 
                  Download  download;
                 
                  boolean auto_start = manager.shouldAutoStart( torrent );
                 
                  if ( auto_start ){
                 
                    download = dm.addDownload( torrent );
                   
                  }else{
                 
                    download = dm.addDownloadStopped( torrent, null, null );
                  }
                 
                  log( subs.getName() + ": added download " + download.getName()+ ": auto-start=" + auto_start );

                  subs.addAssociation( torrent.getHash());
                 
                  result.setRead( true );
                                   
                  if ( tried_ref_switch ){
                   
View Full Code Here

      }
      map.put("job-error", error);
    }
   
    try {
      Torrent torrent = job.getFile().getDownload().getTorrent();
      if (PlatformTorrentUtils.isContent(torrent, true)) {
        map.put("asset-hash", new HashWrapper(torrent.getHash()).toBase32String());
      }
    } catch (Throwable t) {
    }

    map.put("transcode-mode", new Integer(job.getTranscodeRequirement()));
View Full Code Here

          if ( !download.isPersistent()){
           
            continue;
          }
         
          Torrent  torrent = download.getTorrent();
 
          if ( torrent == null ){
           
            continue;
          }
         
          byte[]  hash = torrent.getHash();

          if ( download_info_map.containsKey( hash )){
           
            continue;
          }
         
          String[]  networks = download.getListAttribute( ta_networks );
         
          if ( networks == null ){
           
            continue;
          }
           
          boolean  public_net = false;
         
          for (int i=0;i<networks.length;i++){
           
            if ( networks[i].equalsIgnoreCase( "Public" )){
               
              public_net  = true;
             
              break;
            }
          }
         
          TOTorrent to_torrent = PluginCoreUtils.unwrap( torrent );
         
          if ( public_net && !TorrentUtils.isReallyPrivate( to_torrent )){
           
            DownloadManagerState state = PluginCoreUtils.unwrap( download ).getDownloadState();

            if ( state.getFlag(DownloadManagerState.FLAG_LOW_NOISE )){
             
              continue;
            }
           
            long rand = global_random_id ^ state.getLongParameter( DownloadManagerState.PARAM_RANDOM_SEED );           
           
            long cache = state.getLongAttribute( DownloadManagerState.AT_SCRAPE_CACHE );

            int  seeds_leechers;
           
            if ( cache == -1 ){
             
              seeds_leechers = -1;
             
            }else{
             
              int seeds     = (int)((cache>>32)&0x00ffffff);
              int leechers   = (int)(cache&0x00ffffff);
             
              seeds_leechers   = (int)((seeds<<16)|(leechers&0xffff));
            }

            DownloadInfo info =
              new DownloadInfo(
                hash,
                hash,
                download.getName(),
                (int)rand,
                torrent.isPrivate()?StringInterner.intern(torrent.getAnnounceURL().getHost()):null,
                0,
                false,
                torrent.getSize(),
                (int)( to_torrent.getCreationDate()/(60*60)),
                seeds_leechers,
                (byte)PlatformTorrentUtils.getContentNetworkID( to_torrent ));
           
            new_info.add( info );
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.torrent.Torrent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.