Examples of Download


Examples of org.gudy.azureus2.plugins.download.Download

  public static boolean isOnRemovalEnabled() {
    return COConfigurationManager.getBooleanParameter("File.move.download.removed.enabled");
  }
 
  public static SaveLocationChange recalculatePath(DownloadManager dm) {
    Download download = PluginCoreUtils.wrap(dm);
    SaveLocationChange result = null;
    if (canGoToCompleteDir(dm)) {
      result = CURRENT_HANDLER.onCompletion(download, true, false);
    }
    if (result == null) {
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

   * Find all file locations that a download might exist in - this is used
   * to see locate existing files to reuse to prevent downloads being re-added.
   */
  public static File[] getRelatedDirs(DownloadManager dm) {
    ArrayList result = new ArrayList();
    Download d = PluginCoreUtils.wrap(dm);
   
    if (isOnCompleteEnabled()) {
      addFile(result, COConfigurationManager.getStringParameter("Completed Files Directory"));
      addFile(result, CURRENT_HANDLER.onCompletion(d, false, false));
      addFile(result, DownloadManagerDefaultPaths.DEFAULT_HANDLER.onCompletion(d, false, false));
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

     
      if ( fm_pi == null || ( fm_pi.getPluginVersion() != null && fm_pi.getPluginVersion().equals( "0.0" ))){
       
        Download[] downloads = pi.getDownloadManager().getDownloads();
       
        Download hit = null;
       
        for ( Download download: downloads ){
         
          Torrent torrent = download.getTorrent();
         
          if ( torrent != null && torrent.isSimpleTorrent()){
           
            String name = torrent.getFiles()[0].getName();
           
            if ( name.startsWith( "aefeatman_v_") && name.endsWith( ".zip" )){
             
              hit = download;
             
              break;
            }
          }
        }
       
        if ( hit == null ){
       
          extra = "The 'Vuze Feature Manager' plugin is required but isn't installed";
         
        }else{
         
          int  state = hit.getState();
         
          if (  (state == Download.ST_STOPPED && !hit.isComplete() ) ||
              state == Download.ST_ERROR ){
           
            extra = "The 'Vuze Feature Manager' plugin has failed to download - check your Library's detailed view for errors or stopped downloads";
           
          }else{
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

             
      pw.println"<pubDate>" + TimeFormatter.getHTTPDate( last_modified ) + "</pubDate>" );
   
      for (int i=0;i<downloads.size();i++){
       
        Download download = downloads.get( i );
       
        DownloadManager  core_download = PluginCoreUtils.unwrap( download );
       
        Torrent torrent = download.getTorrent();
       
        byte[] hash = torrent.getHash();
       
        String  hash_str = Base32.encode( hash );
       
        pw.println( "<item>" );
       
        pw.println( "<title>" + escape( download.getName()) + "</title>" );
       
        pw.println( "<guid>" + hash_str + "</guid>" );
       
        String magnet_url = UrlUtils.getMagnetURI( hash );

        pw.println( "<link>" + magnet_url + "</link>" );
       
        long added = core_download.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME);
       
        pw.println"<pubDate>" + TimeFormatter.getHTTPDate( added ) + "</pubDate>" );
       
        pw.println"<vuze:size>" + torrent.getSize()+ "</vuze:size>" );
        pw.println"<vuze:assethash>" + hash_str + "</vuze:assethash>" );
                       
        pw.println( "<vuze:downloadurl>" + magnet_url + "</vuze:downloadurl>" );
   
        DownloadScrapeResult scrape = download.getLastScrapeResult();
       
        if ( scrape != null && scrape.getResponseType() == DownloadScrapeResult.RT_SUCCESS ){
         
          pw.println"<vuze:seeds>" + scrape.getSeedCount() + "</vuze:seeds>" );
          pw.println"<vuze:peers>" + scrape.getNonSeedCount() + "</vuze:peers>" );
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

     
      return( null );
    }

    try{
      Download dl = info.getDownload();
     
      if ( dl != null ){
       
        org.gudy.azureus2.core3.download.DownloadManager dm = unwrap( dl );
       
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

  processCategory(
    Category    cat,
    Object[]    details,
    DownloadManager  dm )
  {
    Download download = PluginCoreUtils.wrap( dm );
   
    if ( download.getFlag( Download.FLAG_LOW_NOISE )){
     
      return;
    }
   
    String str = download.getAttribute( category_ta );
   
    String cat_name = cat.getName();
   
    if ( cat.getType() == Category.TYPE_UNCATEGORIZED ){
     
      cat_name = "<none>";
    }
   
    String  cat_tag = cat_name + ";";
   
    if ( str != null && str.contains( cat_tag )){
     
      return;
    }
   
    try{
      DeviceMediaRenderer    device   = (DeviceMediaRenderer)details[0];
      TranscodeProfile    profile  = (TranscodeProfile)details[1];
           
      log( "Category " + cat_name + " - adding " + download.getName() + " to " + device.getName() + "/" + profile.getName());
     
      DiskManagerFileInfo[] dm_files = download.getDiskManagerFileInfo();
     
      int  num_added = 0;
     
      for ( DiskManagerFileInfo dm_file: dm_files ){
       
          // limit number of files we can add to avoid crazyness
       
        if ( num_added > 64 ){
         
          break;
        }
       
          // could be smarter here and check extension or whatever
       
        if ( dm_files.length == 1 || dm_file.getLength() >= 128*1024 ){
         
          try{
            queue.add( device, profile, dm_file, false  );
         
            num_added++;
           
          }catch( Throwable e ){
           
            log( "    add failed", e );
          }
        }
      }
    }finally{
     
      download.setAttribute( category_ta, str==null?cat_tag:(str+cat_tag));
    }
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

    int      index )
 
    throws TranscodeException
  {
    try{
      Download download = PluginInitializer.getDefaultInterface().getDownloadManager().getDownload( hash );
     
      if ( download == null ){
       
        throw( new TranscodeException( "Download with hash " + ByteFormatter.encodeString( hash ) + " not found" ));
      }
   
      return( download.getDiskManagerFileInfo()[index]);
     
    }catch( Throwable e ){
     
      throw( new TranscodeException( "Download with hash " + ByteFormatter.encodeString( hash ) + " not found", e ));
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

         
          while( it2.hasNext()){
           
            Map.Entry entry = (Map.Entry)it2.next();
           
            Download   dl   = (Download)entry.getKey();
            boolean    now = ((Boolean)entry.getValue()).booleanValue();
           
            if ( now ){
             
              track_now.add( dl );
            }
           
            active_set.add( dl );
          }
         
          if( track_now.size() > 0 ){
         
            to_do.put( buddy, track_now );
          }
        }
      }
    }
   
    synchronized( actively_tracking ){
     
      Iterator it = active_set.iterator();
     
      while( it.hasNext()){
       
        Download dl = (Download)it.next();
       
        if ( !actively_tracking.contains( dl )){
         
          actively_tracking.add( dl );
         
          trackPeers( dl );
        }
      }
     
      it = actively_tracking.iterator();
     
      while( it.hasNext()){
       
        Download dl = (Download)it.next();
       
        if ( !active_set.contains( dl )){
         
          it.remove();
         
          untrackPeers( dl );
        }
      }
    }
   
    Iterator it = to_do.entrySet().iterator();
   
    while( it.hasNext()){
     
      Map.Entry  entry = (Map.Entry)it.next();
         
      BuddyPluginBuddy buddy = (BuddyPluginBuddy)entry.getKey();
     
      if ( !buddy.isOnline( false )){
       
        continue;
      }
     
      InetAddress ip       = buddy.getAdjustedIP();
     
      if ( ip == null ){
       
        continue;
      }
     
      int      tcp_port  = buddy.getTCPPort();
      int      udp_port  = buddy.getUDPPort();
     
      List  downloads = (List)entry.getValue();
     
      for (int i=0;i<downloads.size();i++){
       
        Download  download = (Download)downloads.get(i);
       
        PeerManager pm = download.getPeerManager();
       
        if ( pm == null ){
         
          continue;
        }
       
        Peer[] existing_peers = pm.getPeers( ip.getHostAddress());
     
        boolean  connected = false;
       
        for (int j=0;j<existing_peers.length;j++){
         
          Peer peer = existing_peers[j];
         
          if (   peer.getTCPListenPort() == tcp_port ||
              peer.getUDPListenPort() == udp_port ){
           
            connected = true;
           
            break;
         
        }
       
        if ( connected ){
         
          log( download.getName() + " - peer " + ip.getHostAddress() + " already connected" );
         
          continue;
        }
       
        log( download.getName() + " - connecting to peer " + ip.getHostAddress());

        PEPeerManager c_pm = PluginCoreUtils.unwrap( pm );
       
        Map  user_data = new LightHashMap();
       
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

  {
    boolean  state_changed = false;
   
    synchronized( buddy_peers ){

      Download download = (Download)peer.getUserData( PEER_KEY );
       
      if ( download == null ){
       
        return;
      }

      if ( buddy_peers.remove( peer )){
       
        if ( buddy_peers.size() == 0 ){
         
          state_changed = true;
         
          if ( buddy_stats_timer != null ){
           
            buddy_stats_timer.cancel();
           
            buddy_stats_timer = null;
          }
        }
       
        log( download.getName() + ": removing buddy peer " + peer.getIp());
      }
     
      peer.setUserData( PEER_KEY, null );
     
      peer.setPriorityConnection( false );
View Full Code Here

Examples of org.gudy.azureus2.plugins.download.Download

     
      Iterator it = actively_tracking.iterator();
     
      while( it.hasNext()){
       
        Download download = (Download)it.next();
       
        PeerManager pm = download.getPeerManager();
       
        if ( pm != null ){
         
          Peer[] peers = pm.getPeers();
         
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.