Changeset 2020

Show
Ignore:
Timestamp:
02/19/08 13:41:19
Author:
typester
Message:

added sync_rate option that allows you to sync plagger rate from LDR rate. (patch from cho45)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fastladder-crawler/plagger/lib/Plagger/Plugin/Store/Fastladder.pm

    r2018 r2020  
    1919 
    2020    $self->{me} = $self->rs('Members')->find($self->conf->{member_id}) 
    21         or $c->error(qq{can't find fastladder user member_id: "@{[ $self->conf->{member_id} ]}"}); 
     21        or $c->error(qq{can't find fastladder user member_id: "@{[ $self->conf->{member_id} ]}"}); # " stupid vim 
    2222 
    2323    if ($self->conf->{fetch_favicon}) { 
     
    7070 
    7171    # subscribe 
    72     if ($me->subscriptions({ feed_id => $feed->id })->count == 0) { 
     72    my $subs = $me->subscriptions({ feed_id => $feed->id }); 
     73    if ($subs->count == 0) { 
    7374        $me->add_to_subscriptions({ 
    7475            feed_id    => $feed->id, 
     
    7677            updated_on => $now, 
    7778        }); 
     79    } 
     80 
     81    # setting rate 
     82    if ($self->conf->{sync_rate}) { 
     83        my $sub  = $subs->first; 
     84        my $rate = $args->{feed}->meta->{rate} || 0; 
     85        $c->log( debug => "Setting rate $rate to " . $feed->link); 
     86        $sub->update({ rate => $rate }) unless $sub->rate == $rate; 
    7887    } 
    7988 
     
    213222if set this to true value, crawler fetch favicon. (default: 0) 
    214223 
     224=head2 sync_rate 
     225 
     226if set this to true value, crawler automatically sync feed's rate from its meta info. 
     227 
     228You might want to use this with Subscription::Livedoor. 
     229 
    215230=head1 AUTHOR 
    216231