Package org.gudy.azureus2.plugins.torrent

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


      if ( download == null ){
       
        return( null );
      }
     
      Torrent  t_torrent = download.getTorrent();
     
      if ( t_torrent == null ){
       
        return( null );
      }
View Full Code Here


       
        download_ok = true;
       
      }else{

        Torrent torrent = download.getTorrent();
           
        if (   PlatformTorrentUtils.isContent( torrent, false ) ||
            PlatformTorrentUtils.getContentNetworkID( PluginCoreUtils.unwrap( torrent )) == ContentNetwork.CONTENT_NETWORK_VHDNL ){
         
          download_ok = true;
View Full Code Here

        {
          public void
          downloadAdded(
            Download  download )
          {
            Torrent  torrent = download.getTorrent();
           
            if ( torrent != null ){
             
              byte[]  hash = torrent.getHash();
             
              Object[] entry;
             
              synchronized( potential_associations2 ){
               
                entry = (Object[])potential_associations2.remove( new HashWrapper( hash ));
              }
             
              if ( entry != null ){
               
                SubscriptionImpl[] subs = (SubscriptionImpl[])entry[0];
               
                String  subs_str = "";
                for (int i=0;i<subs.length;i++){
                  subs_str += (i==0?"":",") + subs[i].getName();
                }
               
                log( "Applying deferred asocciation for " + ByteFormatter.encodeString( hash ) + " -> " + subs_str );
               
                recordAssociationsSupport(
                  hash,
                  subs,
                  ((Boolean)entry[1]).booleanValue());
              }
            }
          }
         
          public void
          downloadRemoved(
            Download  download )
          { 
          }
        },
        false );
     
      TorrentUtils.addTorrentAttributeListener(
        new TorrentUtils.torrentAttributeListener()
        {
          public void
          attributeSet(
            TOTorrent   torrent,
            String     attribute,
            Object     value )
          {
            if ( attribute == TorrentUtils.TORRENT_AZ_PROP_OBTAINED_FROM ){
             
              try{
                checkPotentialAssociations( torrent.getHash(), (String)value );
               
              }catch( Throwable e ){
               
                Debug.printStackTrace(e);
              }
View Full Code Here

         
            // PlatformTorrentUtils.setContentThumbnail(torrent, thumbnail);
           
          TorrentUtils.setFlag( torrent, TorrentUtils.TORRENT_FLAG_LOW_NOISE, true );
         
          Torrent t = new TorrentImpl( torrent );
         
          t.setDefaultEncoding();
         
          t.writeToFile( torrent_file );
         
          download = dm.addDownload( t, torrent_file, data_file );
         
          download.setFlag( Download.FLAG_DISABLE_AUTO_FILE_MOVE, true );
View Full Code Here

        break;
      }
      case UIManagerEvent.ET_OPEN_TORRENT_VIA_TORRENT:
     
        Torrent t = (Torrent)data;
       
        try{
          File f = AETemporaryFileHandler.createTempFile();
         
          t.writeToFile( f );
         
          TorrentOpener.openTorrent( f.toString());

        }catch( Throwable e ){
         
View Full Code Here

               
                Download  download = (Download)rows[i].getDataSource();
             
                if ( download != null ){
                 
                  Torrent torrent = download.getTorrent();
                 
                  if ( torrent != null ){
                   
                    hashes.add( torrent.getHash());
                  }
                }
              }
                           
              menu.removeAllChildItems();
View Full Code Here

          if ( dl == null ){
           
            return;
          }
         
          Torrent  torrent = dl.getTorrent();
         
          if ( torrent != null ){
           
            Subscription[] subs = subs_man.getKnownSubscriptions( torrent.getHash());
                           
            int  num_subscribed    = 0;
            int  num_unsubscribed  = 0;
           
            for (int i=0;i<subs.length;i++){
             
              if ( subs[i].isSubscribed()){
                               
                num_subscribed++;
               
              }else{
               
                num_unsubscribed++;
              }
            }
           
            Graphic graphic;
            String  tooltip;
           
            int height = cell.getHeight();
           
            int  sort_order = 0;
           
            if ( subs.length == 0 ){
             
              graphic = null;
              tooltip  = null;
             
            }else{
           
              if ( num_subscribed == subs.length ){
               
                graphic = height >= 22?icon_rss_all_add_big:icon_rss_all_add_small;
               
                tooltip = MessageText.getString( "subscript.all.subscribed" );
               
              }else if ( num_subscribed > 0 ){
               
                graphic = height >= 22?icon_rss_some_add_big:icon_rss_some_add_small;

                tooltip = MessageText.getString( "subscript.some.subscribed" );

                sort_order  = 10000;
               
              }else{
               
                graphic = height >= 22?icon_rss_big:icon_rss_small;
               
                tooltip = MessageText.getString( "subscript.none.subscribed" );
               
                sort_order  = 1000000;
              }
            }
           
            sort_order += 1000*num_unsubscribed + num_subscribed;
           
            cell.setMarginHeight(0);
            cell.setGraphic( graphic );
            cell.setToolTip( tooltip );
           
            cell.setSortValue( sort_order );
           
            cell.setCursorID( graphic==null?SWT.CURSOR_ARROW:SWT.CURSOR_HAND );

          }else{
           
            cell.setCursorID( SWT.CURSOR_ARROW );
           
            cell.setSortValue( 0 );
          }
        }
      };
     
    final TableCellMouseListener  subs_mouse_listener =
      new TableCellMouseListener()
      {
        public void
        cellMouseTrigger(
          TableCellMouseEvent event )
        {
          if ( event.eventType == TableCellMouseEvent.EVENT_MOUSEDOWN ){
           
           
            TableCell cell = event.cell;
           
            Download  dl = (Download)cell.getDataSource();
           
            Torrent  torrent = dl.getTorrent();
           
            if ( torrent != null ){
             
              SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();
              Subscription[] subs = subs_man.getKnownSubscriptions( torrent.getHash());
             
              if ( subs.length > 0 ){
               
                event.skipCoreFunctionality  = true;

                new SubscriptionWizard(PluginCoreUtils.unwrap(dl));
               
                COConfigurationManager.setParameter( "subscriptions.wizard.shown", true );

                refreshTitles( mdiEntryOverview );
               
                //new SubscriptionListWindow(PluginCoreUtils.unwrap(dl),true);
              }
            }
          }
        }
      };
     
    table_manager.registerColumn(
      Download.class,
      "azsubs.ui.column.subs",
      new TableColumnCreationListener()
      {
        public void tableColumnCreated(TableColumn result) {
          result.setAlignment(TableColumn.ALIGN_CENTER);
          result.setPosition(TableColumn.POSITION_LAST);
          result.setWidth(32);
          result.setRefreshInterval(TableColumn.INTERVAL_INVALID_ONLY);
          result.setType(TableColumn.TYPE_GRAPHIC);
       
          result.addCellRefreshListener( subs_refresh_listener );
          result.addCellMouseListener( subs_mouse_listener );
          result.setIconReference("image.subscription.column", true);
         
          synchronized (columns) {
            columns.add(result);
          }
        }
      });
   
    final TableCellRefreshListener  link_refresh_listener =
      new TableCellRefreshListener()
      {
        public void
        refresh(
          TableCell _cell )
        {
          TableCellSWT cell = (TableCellSWT)_cell;
         
          SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();
          if ( subs_man == null ){
           
            return;
          }
         
          Download  dl = (Download)cell.getDataSource();
         
          if ( dl == null ){
           
            return;
          }
         
          String  str     = "";
         
          Torrent  torrent = dl.getTorrent();
         
          if ( torrent != null ){
           
            byte[]  hash = torrent.getHash();
           
            Subscription[] subs = subs_man.getKnownSubscriptions( hash );
                           
            for (int i=0;i<subs.length;i++){
             
              Subscription sub = subs[i];
             
              if ( sub.hasAssociation( hash )){
               
                str += (str.length()==0?"":"; ") + sub.getName();
              }
            }
          }
         
          cell.setCursorID( str.length() > 0?SWT.CURSOR_HAND:SWT.CURSOR_ARROW );
         
          cell.setText( str );
        }
      };
   
      final TableCellMouseListener  link_mouse_listener =
        new TableCellMouseListener()
        {
          public void
          cellMouseTrigger(
            TableCellMouseEvent event )
          {
            if ( event.eventType == TableCellMouseEvent.EVENT_MOUSEDOWN ){
                   
              TableCell cell = event.cell;
             
              Download  dl = (Download)cell.getDataSource();
             
              Torrent  torrent = dl.getTorrent();

              SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();

              if ( torrent != null && subs_man != null ){
               
                byte[]  hash = torrent.getHash();
               
                Subscription[] subs = subs_man.getKnownSubscriptions( hash );
                               
                for (int i=0;i<subs.length;i++){
                 
View Full Code Here

      // only add the azid to platform content

    DownloadManagerStateAttributeListener dmsal = new DownloadManagerStateAttributeListener() {
      public void attributeEventOccurred(org.gudy.azureus2.core3.download.DownloadManager dm, String attribute_name, int event_type) {
        try{             
          Torrent t = download.getTorrent();
          if (t == null) {return;}
          if (!PlatformTorrentUtils.isContent(t, true)) {return;}
          DownloadUtils.addTrackerExtension(download, EXTENSION_PREFIX, ConstantsVuze.AZID)
         
          // allow the tracker to manipulate peer sources for dead/unauthorised torrents
View Full Code Here

      try {
        DiskManagerFileInfo file = tf.getSourceFile();
        if (file != null) {
          Download download = file.getDownload();
          if (download != null) {
            Torrent torrent = download.getTorrent();
            if (torrent != null) {
              return PluginCoreUtils.unwrap(torrent);
            }
          }
        }
      } catch (Throwable e) {
      }
    }

    if (ds instanceof TranscodeJob) {
      TranscodeJob tj = (TranscodeJob) ds;
      try {
        DiskManagerFileInfo file = tj.getFile();
        if (file != null) {
          Download download = tj.getFile().getDownload();
         
          if (download != null) {
            Torrent torrent = download.getTorrent();
            if (torrent != null) {
              return PluginCoreUtils.unwrap(torrent);
            }
          }
        }
      } catch (DownloadException e) {
      }
    }
   
    if (ds instanceof DeviceOfflineDownload ){
      Torrent torrent = ((DeviceOfflineDownload) ds).getDownload().getTorrent();
      if (torrent != null) {
        return PluginCoreUtils.unwrap(torrent);
      }
    }
View Full Code Here

 
  public void
  downloadAdded(
    final Download  download )
  {
    Torrent  torrent = download.getTorrent();
   
    if ( torrent != null && torrent.isPrivate()){
     
      download.addTrackerListener(
        new DownloadTrackerListener()
        {
          public void
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.