Changeset 368

Show
Ignore:
Timestamp:
03/08/06 11:00:27
Author:
miyagawa
Message:
  • Added cache->path_to() to get plugin specific tmp filepath.
  • Support URI in iTunesRecentPlay filepath
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Cache.pm

    r279 r368  
    2929        cache => $conf->{class}->new($conf->{params}), 
    3030    }, $class; 
     31} 
     32 
     33sub path_to { 
     34    my($self, @path) = @_; 
     35    File::Spec->catfile($self->{base}, @path); 
    3136} 
    3237 
  • trunk/plagger/lib/Plagger/CacheProxy.pm

    r231 r368  
    2020} 
    2121 
     22sub path_to { 
     23    my($self, @path) = @_; 
     24    $self->{cache}->path_to($self->{namespace}, @path); 
     25} 
     26 
    2227sub cookie_jar { 
    2328    my $self = shift; 
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/iTunesRecentPlay.pm

    r366 r368  
    4040            return; 
    4141        } 
     42    } 
     43 
     44    my $uri = URI->new($file); 
     45    if ($uri->scheme) { 
     46        $file = $self->cache->path_to('iTunes Music Library.xml'); 
     47 
     48        my $ua = Plagger::UserAgent->new; 
     49        my $response = $ua->mirror($uri => $file); 
     50        if ($response->is_error) { 
     51            $context->log(error => "GET $uri failed: " . $response->status_line); 
     52            return; 
     53        } 
     54 
     55        $context->log(info => "Downloaded $uri to $file"); 
    4256    } 
    4357