root/trunk/plagger/lib/Plagger/Plugin/Subscription/Bookmarks/InternetExplorer.pm

Revision 994 (checked in by miyagawa, 14 years ago)

added TODO as comment

Line 
1 package Plagger::Plugin::Subscription::Bookmarks::InternetExplorer;
2 use base qw( Plagger::Plugin::Subscription::Bookmarks );
3
4 use Encode;
5 use File::Basename qw( basename );
6 use Win32::IEFavorites;
7 use Win32::Locale;
8
9 use URI;
10
11 sub load {
12     my($self, $context) = @_;
13
14     my @items = Win32::IEFavorites->find(); # TODO: support expression?
15     for my $item (@items) {
16         my $url = URI->new( $item->url );
17         next if $url->scheme !~ /^http/;
18
19         my $language = Win32::Locale::get_language();
20         my $fs_encoding = $lanuage eq 'ja' ? "cp932" : "latin-1"; # xxx utf-8?
21
22         my $title = basename($item->path);
23         $title =~ s/\.url$//;
24         $title = decode($fs_encoding, $title);
25        
26         my $feed = Plagger::Feed->new;
27         $feed->url($item->url);
28         $feed->title($title);
29         # TODO: add favico?
30         # TODO: tag support by folder name
31         
32         $context->subscription->add($feed);
33     }
34 }
35
36 1;
Note: See TracBrowser for help on using the browser.