Changeset 365

Show
Ignore:
Timestamp:
03/07/06 22:30:55
Author:
mizzy
Message:

Added duration parameter.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/iTunesRecentPlay.pm

    r360 r365  
    77use DateTime::Format::W3CDTF; 
    88use HTML::Entities; 
     9use LWP::Simple; 
    910 
    1011sub register { 
     
    7172                        next; 
    7273                    } 
    73                     for my $key (keys %$data){ 
    74                         $entry->meta->{$key} = $data->{$key}; 
     74                    if( !defined $self->conf->{duration} or $dt->epoch > time - $self->conf->{duration} * 60 ){ 
     75                        for my $key (keys %$data){ 
     76                            $entry->meta->{$key} = $data->{$key}; 
     77                        } 
     78                        $entry->date(Plagger::Date->from_epoch($dt->epoch)); 
     79                        $context->log( debug => $data->{artist} . ' ' . $data->{track}); 
     80                        $feed->add_entry($entry); 
    7581                    } 
    76                     $entry->date(Plagger::Date->from_epoch($dt->epoch)); 
    77                     $context->log( debug => $data->{artist} . ' ' . $data->{track}); 
    78                     $feed->add_entry($entry); 
    7982                } 
    8083                $data = {}; 
     
    9497=head1 SYNOPSIS 
    9598 
     99  # entries updated within 120 minutes 
    96100  - module: CustomFeed::iTunesRecentPlay 
    97101    config: 
    98102      library_path: /path/to/iTunes Music Library.xml 
    99       reload_period: 360
     103      duration: 12
    100104 
    101105=head1 DESCRIPTION 
     
    112116this plugin try to find it automatically. 
    113117 
    114 =item reload_period 
     118=item duration 
    115119 
    116120This plugin find a music played recently if last played time is within 
    117 this parameter.It's good to define this parameter same as execution  
    118 period of plagger with cron
     121this parameter.It's good to define this parameter same as execution 
     122period of plagger with cron to reduce memory usage
    119123 
    120124=back