Plagger::Plugin::Publish::iPodNotes
å®ã¯çµæ§åãã Plagger ã§åå¾ãã RSS ã iPod ã® Notes ã§èªããã©ã°ã¤ã³ãèªåã§ä½ã£ã¦ä½¿ã£ã¦ãã®ã§ãããæ¨æ¥ã® YAPC::Asia åæ¥ã® Plagger ã® session ã§ãã¾ã iPod ã® Notes ã«æ¸ãåºã Plugin ããªãã¨ãããã¨ãç¥ã£ãã®ã§ãã¡ãã£ã¨æ¥ããããã®ã§ããæä½ãããã«æãã¦ããã¾ãã
iPodNotes.pm
package Plagger::Plugin::Publish::iPodNotes; use strict; use base qw( Plagger::Plugin ); use File::Spec; use iPod::Notes; our $VERSION = '0.01'; sub register { my( $self, $context ) = @_; $context->register_hook( $self, 'publish.feed' => \&feed, ); } sub feed { my( $self, $context, $args ) = @_; my $cfg = $self->conf; my $feed = $args->{feed}; my $url = $feed->{url}; $url =~ s![:/\.\&\?]!_!g; my $article_name = File::Spec->catfile( 'Blogs', $url ); my $i; my $index; for my $entry ( @{ $feed->{entries} } ) { my $article_num = sprintf "%03d", $i++; my $note = iPod::Notes->new( Title => $article_num, Docpath => $article_name, Content => $entry->body, NotesPath => $cfg->{notes_path}, Debug => $cfg->{debug}, ); $note->write; $index .= sprintf "<a href=\"%s/%s\">* </a>%s\n", $article_name, $article_num, $entry->title; } my $note = iPod::Notes->new( Title => $feed->title, Content => $index, ); $note->write; return 1; } 1;
ãã®ä¸ã§ä½¿ã£ã¦ãã
iPod::Notes ã¨ããã®ãèªä½ã§ãCPAN ã«ã¯ç»é²ãã¦ããªãã®ã§ããã«æãã¦ããã¾ãã RSS 以å¤ã®ããã¹ããã¡ã¤ã«ã iPod ã«è»¢éããããã«ä½¿ã£ã¦ããã§ããã©ã
iPod::Notes 㯠WindowsXP + cygwin + perl5.8.7 + iPod photo ã§æ£å¸¸ã«åä½ãã¦ãããã¨ã確èªãã¦ãã¾ããæ ActivePerl ã§ãåãã¦ããã§ããã©ããã¾ã¯ç¥ãã¾ããã
CPAN ã£ã¦ç»é²ãããã¨ãªããã ãã©ãiPod ã® Notes ã£ã¦ iPod ã® version ã«ãã£ã¦ç´°ããéãã¿ããã ããä»ã¯å ¨ã¦ utf8 ã«å¼·å¶å¤æãã¦ããããããªãã®ãç»é²ãã¦ãããã®ããªãï¼(ãã¨ãååãè¯ããªãã¨ã)
ãããã㨠config.yaml ãå¿ è¦ã§ããã
- module: Publish::iPodNotes config: debug: 1 notes_path: - cygdrive - f - Notes
ãããªã®ã config.yaml ã«è¿½å ãã¦ãã ãããdebug ã¯ãªãã¦ãå ¨ç¶æ§ããªããã©ãnotes_path 㯠mount ãã¦ãã iPod ã® Notes ãã£ã¬ã¯ããªã¾ã§ã® path ã§ãã
ããåºçºããªã㨠YAPC::Asia 2æ¥ç®ã«éã«åããªããªãããã§ã¯ä¼å ´ã§ã