Package org.gudy.azureus2.plugins.utils.xml.rss

Examples of org.gudy.azureus2.plugins.utils.xml.rss.RSSFeed


   *
   * @since 3.0.0.7
   */
  private boolean nextUpdate() {
    if (iterDownloaders.hasNext()) {
      ResourceDownloader downloader = (ResourceDownloader) iterDownloaders.next();
      downloader.addListener(this);
      downloader.asyncDownload();
      return true;
    }
    return false;
  }
View Full Code Here


              }
             
              setProgress( 0 );
             
              downloader.addListener(
                new ResourceDownloaderAdapter()
                {
                  public void
                  reportPercentComplete(
                    ResourceDownloader  downloader,
                    int          percentage )
View Full Code Here

    singleton = this;
   
    init_sem.release();
   
    try{
      RSSFeed feed = plugin_interface.getUtilities().getRSSFeed(new URL("http://aelitis.com:7979/rss_feed.xml"));
     
      RSSChannel[]  channels = feed.getChannels();
     
      for (int i=0;i<channels.length;i++){
       
        RSSChannel  channel = channels[i];
       
View Full Code Here

    }
   
    try {
      ByteArrayInputStream bais = new ByteArrayInputStream( page.getBytes("UTF-8"));
     
      RSSFeed rssFeed = StaticUtilities.getRSSFeed( bais );
     
      RSSChannel[] channels = rssFeed.getChannels();
     
      List results = new ArrayList();
     
      for ( int i=0; i<channels.length; i++ ){
       
        RSSChannel channel = channels[i];
       
        SimpleXMLParserDocumentNode[] channel_kids = channel.getNode().getChildren();
       
        int  auto_dl_state = AUTO_DL_SUPPORTED_YES;
       
        for ( int j=0; j<channel_kids.length; j++ ){

          SimpleXMLParserDocumentNode child = channel_kids[j];

          String  lc_full_child_name   = child.getFullName().toLowerCase();

          if ( lc_full_child_name.equals( "vuze:auto_dl_enabled" )){
           
            if ( !child.getValue().equalsIgnoreCase( "true" )){
             
              auto_dl_state = AUTO_DL_SUPPORTED_NO;
            }
          }
        }     
       
        setLocalLong( LD_AUTO_DL_SUPPORTED, auto_dl_state );
       
        RSSItem[] items = channel.getItems();

        for ( int j=0 ; j<items.length; j++ ){
         
          RSSItem item = items[j];
         
          WebResult result = new WebResult(this,getRootPage(),getBasePage(),getDateParser(),"");
         
          result.setPublishedDate(item.getPublicationDate());
         
          result.setNameFromHTML(item.getTitle());
         
          URL cdp_link = item.getLink();
         
          if ( cdp_link != null ){
         
            result.setCDPLink(cdp_link.toExternalForm());
          }
         
          String uid = item.getUID();
         
          if ( uid != null ){
           
            result.setUID( uid );
          }
         
          boolean got_seeds_peers = false;
         
          SimpleXMLParserDocumentNode node = item.getNode();
         
          if ( node != null ){
           
            SimpleXMLParserDocumentNode[] children = node.getChildren();
           
            boolean vuze_feed = false;
           
            for ( int k=0; k<children.length; k++ ){
                           
              SimpleXMLParserDocumentNode child = children[k];
             
              String  lc_full_child_name   = child.getFullName().toLowerCase();
             
              if ( lc_full_child_name.startsWith( "vuze:" )){
               
                vuze_feed = true;
               
                break;
              }
            }
           
            for ( int k=0; k<children.length; k++ ){
             
              SimpleXMLParserDocumentNode child = children[k];
             
              String  lc_child_name     = child.getName().toLowerCase();
              String  lc_full_child_name   = child.getFullName().toLowerCase();
             
              String  value = child.getValue();
             
              if (lc_child_name.equals( "enclosure" )){
               
                SimpleXMLParserDocumentAttribute typeAtt = child.getAttribute("type");
               
                if( typeAtt != null && typeAtt.getValue().equalsIgnoreCase( "application/x-bittorrent")) {
                 
                  SimpleXMLParserDocumentAttribute urlAtt = child.getAttribute("url");
                 
                  if( urlAtt != null ){
                   
                    result.setTorrentLink(urlAtt.getValue());
                  }
                 
                  SimpleXMLParserDocumentAttribute lengthAtt = child.getAttribute("length");
                 
                  if (lengthAtt != null){
                   
                    result.setSizeFromHTML(lengthAtt.getValue());
                  }
                }
              }else if(lc_child_name.equals( "category" )) {
                               
                result.setCategoryFromHTML( value );
               
              }else if(lc_child_name.equals( "comments" )){
               
                result.setCommentsFromHTML( value );
               
              }else if ( lc_child_name.equals( "link" ) || lc_child_name.equals( "guid" )) {
               
                String lc_value = value.toLowerCase();
                               
                try{
                  URL url = new URL(value);

                  if (   lc_value.endsWith( ".torrent" ) ||
                      lc_value.startsWith( "magnet:" ) ||
                      lc_value.startsWith( "bc:" ) ||
                      lc_value.startsWith( "bctp:" ) ||
                      lc_value.startsWith( "dht:" )){
                   
                   
                    result.setTorrentLink(value);
                   
                  }else if ( lc_child_name.equals( "link" ) && !vuze_feed ){
                 
                    long  test = getLocalLong( LD_LINK_IS_TORRENT, 0 );
                 
                    if ( test == 1 ){
                   
                      result.setTorrentLink( value );
                     
                    }else if ( test == 0 || SystemTime.getCurrentTime() - test > 60*1000 ){
                   
                      if ( linkIsToTorrent( url )){
                     
                        result.setTorrentLink(value);
                       
                        setLocalLong( LD_LINK_IS_TORRENT, 1 );
                       
                      }else{
                       
                        setLocalLong( LD_LINK_IS_TORRENT, SystemTime.getCurrentTime());
                      }
                    }
                  }
                }catch( Throwable e ){
                 
                    // see if this is an atom feed
                    //  <link rel="alternate" type="application/x-bittorrent" href="http://asdasd/
                 
                  SimpleXMLParserDocumentAttribute typeAtt = child.getAttribute( "type" );
                 
                  if ( typeAtt != null && typeAtt.getValue().equalsIgnoreCase("application/x-bittorrent")) {
                 
                    SimpleXMLParserDocumentAttribute hrefAtt = child.getAttribute( "href" );
                   
                    if ( hrefAtt != null ){
                     
                      String  href = hrefAtt.getValue().trim();
                     
                      try{
                       
                        result.setTorrentLink( new URL( href ).toExternalForm() );
                       
                      }catch( Throwable f ){
                       
                      }
                    }
                  }
                }
              }else if ( lc_child_name.equals( "content" ) && rssFeed.isAtomFeed()){
               
                SimpleXMLParserDocumentAttribute srcAtt = child.getAttribute( "src" );
               
                String  src = srcAtt==null?null:srcAtt.getValue();
                     
View Full Code Here

        Map  args = new HashMap();
       
       
           
            try {
                RSSFeed feed = pluginInterface.getUtilities().getRSSFeed(new URL(rss_url));
                  RSSChannel[] channels = feed.getChannels();
             
                  for (int i = 0 ; i < channels.length ; i++)
                  {
                      final RSSChannel channel = channels[i];
                      View.display.asyncExec(new Runnable (){
View Full Code Here

    props         = new propertyWrapper(_props );
    pluginDir       = _pluginDir;
    config         = new PluginConfigImpl(this,pluginConfigKey);
    given_plugin_id      = _plugin_id;
    plugin_version    = _plugin_version;
    ipc_interface      = new IPCInterfaceImpl( initialiser, plugin );
    state                 = new PluginStateImpl(this, initialiser);
   
    boolean verified   = false;
    boolean bad    = false;
   
View Full Code Here

  }
 
  public IPFilter
  getIPFilter()
  {
    return( new IPFilterImpl());
  }
View Full Code Here

 
  public Logger getLogger()
  {
    if ( logger == null ){
     
      logger = new LoggerImpl( this );
    }
   
    return( logger );
  }
View Full Code Here

    else {
      plug_msg = new MessageAdapter( message )//core created
    }
   
    RawMessage raw_plug = plug_encoder.encodeMessage( plug_msg );
    return new com.aelitis.azureus.core.networkmanager.RawMessage[]{ new RawMessageAdapter( raw_plug )};
  }
View Full Code Here

    return config;
  }


  public PluginConfigUIFactory getPluginConfigUIFactory() {
    return new PluginConfigUIFactoryImpl(config,pluginConfigKey);
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.utils.xml.rss.RSSFeed

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.