Examples of Torrent


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

      // if this didn't work then nothing much else will so just fall through
     
      return;
    }
   
    Torrent t = dl.getTorrent();
   
    if ( t != null ){
     
      if TorrentUtils.isReallyPrivate( PluginCoreUtils.unwrap( t ))){
       
View Full Code Here

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

  public ExternalSeedReader[]
   getSeedReaders(
     ExternalSeedPlugin    plugin,
     Download        download )
  {   
    Torrent  torrent = download.getTorrent();
   
    try{
      Map  config = new HashMap();
     
      Object  obj = torrent.getAdditionalProperty( "httpseeds" );
     
      if ( obj != null ){
       
        config.put( "httpseeds", obj );
      }
View Full Code Here

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

    getSeedReaders(
      ExternalSeedPlugin    plugin,
      Download        download,
      Map            config )
  {   
    Torrent  torrent = download.getTorrent();
   
    try{
      Object  obj = config.get( "httpseeds" );
     
        // might as well handle case where there's a single entry rather than a list
View Full Code Here

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

      reply.put( "type", new Long( RT_AZ2_REPLY_MESSAGE ));

    }else if type == RT_AZ2_REQUEST_SEND_TORRENT ){
     
      try{
        final Torrent  torrent = plugin.getPluginInterface().getTorrentManager().createFromBEncodedData((byte[])request.get( "torrent" ));
     
        new AEThread2( "torrentAdder", true )
        {
          public void
          run()
          {
            PluginInterface pi = plugin.getPluginInterface();
           
            String msg = pi.getUtilities().getLocaleUtilities().getLocalisedMessageText(
                "azbuddy.addtorrent.msg",
                new String[]{ from_buddy.getName(), torrent.getName() });
           
            long res = pi.getUIManager().showMessageBox(
                    "azbuddy.addtorrent.title",
                    "!" + msg + "!",
                    UIManagerEvent.MT_YES | UIManagerEvent.MT_NO );
View Full Code Here

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

 
  public void
  downloadAdded(
    final Download  download )
  {
    Torrent t = download.getTorrent();
   
    if ( t == null ){
     
      return;
    }
   
    if ( t.isPrivate()){
     
      download.addTrackerListener(
        new DownloadTrackerListener()
        {
          public void
View Full Code Here

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

 
  protected boolean
  okToTrack(
    Download  d )
  {
    Torrent  t = d.getTorrent();
   
    if ( t == null ){
     
      return( false );
    }
   
      // only track private torrents if we have successfully received peers from tracker
      // which means we have the torrent legitimately. As this rule is enforced by both
      // ends of the tracking operation it means we will only track between peers that
      // both have a legitimate copy of the torrent.
       
    if ( t.isPrivate()){
     
      DownloadAnnounceResult announce = d.getLastAnnounceResult();

      if (   announce == null ||
          announce.getResponseType() != DownloadAnnounceResult.RT_SUCCESS ||
View Full Code Here

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

   
    protected
    downloadData(
      Download  download )
    {
      Torrent t = download.getTorrent();
     
      if ( t != null ){
       
        byte[]  hash = t.getHash();
       
        SHA1  sha1 = new SHA1();
     
        sha1.update( ByteBuffer.wrap( IV ));
        sha1.update( ByteBuffer.wrap( hash ));
View Full Code Here

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

  public ExternalSeedReader[]
     getSeedReaders(
       ExternalSeedPlugin    plugin,
       Download        download )
    {   
      Torrent  torrent = download.getTorrent();
     
      try{
        Map  config = new HashMap();
       
        Object  obj = torrent.getAdditionalProperty( "url-list" );
       
        if ( obj != null ){
         
          config.put( "url-list", obj );
        }
       
       obj = torrent.getAdditionalProperty( "url-list-params" );
       
        if ( obj != null ){
         
          config.put( "url-list-params", obj );
        }
       
      obj = torrent.getAdditionalProperty( "url-list-params2" );
       
        if ( obj != null ){
         
          config.put( "url-list-params2", obj );
        }
View Full Code Here

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

             
              return;
            }
          }
         
          Torrent torrent = download.getTorrent();
         
          if ( torrent != null && !TorrentUtils.isReallyPrivate( PluginCoreUtils.unwrap( torrent ))){
           
            torrents.add( torrent );
          }
View Full Code Here

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

   
    for (int i=0;i<downloads.length;i++){
     
      Download download = downloads[i];
     
      Torrent torrent = download.getTorrent();
     
      if ( torrent == null ){
       
        continue;
      }
     
      String dl_cat = download.getAttribute( ta_category );
   
      if (   category.equalsIgnoreCase( "all" ) ||
          ( dl_cat != null && dl_cat.equals( category ))){
       
        if ( !TorrentUtils.isReallyPrivate( PluginCoreUtils.unwrap( torrent ))){
         
          selected_dls.add( download );
         
          byte[] hash = torrent.getHash();
         
          int  num = (hash[0]<<24)&0xff000000 | (hash[1] << 16)&0x00ff0000 | (hash[2] << 8)&0x0000ff00 | hash[3]&0x000000ff;

          fingerprint += num;
        }
      }
    }
   
    PluginConfig pc = plugin_interface.getPluginconfig();

    String  feed_finger_key = "feed_finger.category." + category;
    String  feed_date_key   = "feed_date.category." + category;

    long  existing_fingerprint   = pc.getPluginLongParameter( feed_finger_key, 0 );
    long  feed_date         = pc.getPluginLongParameter( feed_date_key, 0 );

    long  now = SystemTime.getCurrentTime();

    if ( existing_fingerprint == fingerprint ){
     
        // update every now and then to pick up new peer/seed values
     
      if ( selected_dls.size() > 0 ){

        if (   now < feed_date ||
            now - feed_date > FEED_UPDATE_MIN_MILLIS ){
         
          feed_date = now;
       
          pc.setPluginParameter( feed_date_key, feed_date );
        }
      }
    }else{
     
      pc.setPluginParameter( feed_finger_key, fingerprint );
     
     
        // ensure feed date goes up
     
      if ( now <= feed_date ){
       
        feed_date++;
       
      }else{
       
        feed_date = now;
      }
     
      pc.setPluginParameter( feed_date_key, feed_date );
    }
   
    String last_modified = TimeFormatter.getHTTPDate( feed_date );

    if ( if_mod != null && if_mod.equals( last_modified )){
     
      return( new feedDetails( new byte[0], last_modified ));
    }
       
    ByteArrayOutputStream  os = new ByteArrayOutputStream();
     
    try{
      PrintWriter pw = new PrintWriter(new OutputStreamWriter( os, "UTF-8" ));
     
      pw.println( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
     
      pw.println( "<rss version=\"2.0\" xmlns:vuze=\"http://www.vuze.com\">" );
     
      pw.println( "<channel>" );
     
      pw.println( "<title>" + escape( category ) + "</title>" );
     
      Collections.sort(
        selected_dls,
        new Comparator<Download>()
        {
          public int
          compare(
            Download d1,
            Download d2)
          {
            long  added1 = getAddedTime( d1 )/1000;
            long  added2 = getAddedTime( d2 )/1000;
   
            return((int)(added2 - added1 ));
          }
        });
               
             
      pw.println"<pubDate>" + last_modified + "</pubDate>" );
   
      for (int i=0;i<selected_dls.size();i++){
       
        Download download = (Download)selected_dls.get( i );
       
        DownloadManager  core_download = PluginCoreUtils.unwrap( download );
       
        Torrent torrent = download.getTorrent();
       
        String  hash_str = Base32.encode( torrent.getHash());
       
        pw.println( "<item>" );
       
        pw.println( "<title>" + escape( download.getName()) + "</title>" );
       
        pw.println( "<guid>" + hash_str + "</guid>" );
       
        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>" );
       
        String url = "azplug:?id=azbuddy&name=Friends&arg=";
       
        String arg = "pk=" + getPublicKey() + "&cat=" + category + "&hash=" + Base32.encode(torrent.getHash());

        url += URLEncoder.encode( arg, "UTF-8" );
     
        pw.println( "<vuze:downloadurl>" + escape( url ) + "</vuze:downloadurl>" );
   
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.