/[Grep]/lib/Grep/Action/AddFeed.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Grep/Action/AddFeed.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 68 by dpavlin, Wed Feb 21 19:10:20 2007 UTC revision 69 by dpavlin, Thu Feb 22 16:57:23 2007 UTC
# Line 79  sub take_action { Line 79  sub take_action {
79    
80          Jifty->log->debug("trying to find feed on $uri");          Jifty->log->debug("trying to find feed on $uri");
81    
82          my @feeds = Feed::Find->find( sprintf( $uri, $search_moniker ), $ua );          my $r = $ua->get( sprintf( $uri, $search_moniker ) );
83    
84            return $self->result->error( $r->status_line . " from $uri" ) unless ( $r->is_success );
85    
86            if ($r->header('Content-type') =~ /xml/) {
87                    $self->result->message( "Assuming $uri is feed and using it" );
88                    return $self->SUPER::take_action( @ARGS );
89            }
90    
91            my @feeds = Feed::Find->find_in_html( $r->content );
92    
93          if (@feeds) {          if (@feeds) {
94    
# Line 96  sub take_action { Line 105  sub take_action {
105    
106                  return $self->result->error("Can't find any feed at $uri") unless ( $feed_uri );                  return $self->result->error("Can't find any feed at $uri") unless ( $feed_uri );
107    
108                  $self->result->message('Found ' . @feeds . ' feeds, using first one. ' . join(" ", @feeds) );                  $self->result->message('Found ' . @feeds . " feeds, using first: $feed_uri" );
109                  $self->argument_value('uri', $feed_uri);                  $self->argument_value('uri', $feed_uri);
110    
111                  Jifty->log->debug("calling parent take_action with new uri $feed_uri");                  Jifty->log->debug("calling parent take_action with new uri $feed_uri");
# Line 105  sub take_action { Line 114  sub take_action {
114    
115          } else {          } else {
116    
                 my $r = $ua->get( sprintf( $uri, $search_moniker ) );  
117                  warn "no feeds in ", $r->content;                  warn "no feeds in ", $r->content;
118    
119                  $self->result->error('No feeds found on supplied URI');                  $self->result->error('No feeds found on supplied URI');

Legend:
Removed from v.68  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26