Plaggerを使ってみる(Bloglinesの記事をGMAILに送信)

ということで、無事にPlaggerがインストール出来たらPlaggerを試してみる。
今回試したのは、Bloglines(オンラインRSSリーダ)の未読記事を、
GMAILに送信するというやつを試してみる。

cpanでPlaggerをインストールした場合、$HOME/.cpan以下にPlaggerのソースがある。

$HOME/.cpan/build/Plagger-*/examples

ここにPlaggerの設定ファイルがあるのでそれを利用する。
まず、自分のホームディレクトリに設定ファイルをコピーする。

cp .cpan/build/Plagger-*/examples/bloglines2gmail.yaml ./

コピーしてきたbloglines2gmail.yamlを自分の環境に合わせて設定する。

# Fetch Bloglines unread items using Bloglines Web Services API
# and send HTML emails for each feed (not entry)

global:
  # Set timezone to your local one
  timezone: Asia/Tokyo
  # this make logger logs important information
  log:
    level: info

plugins:
  # Fetch your Bloglines updated entries using Bloglines API
  # Mark them read if the retrieval succceeds.
  # Fetch optional metadata by using listsubs API
  – module: Subscription::Bloglines
    config:
      username: [username]
      password: [password]
      mark_read: 1 # 実験の時は0にしておくと既読にならない
      fetch_meta: 1

  # Add "Add to del.icio.us" Widget in the Email body
  – module: Widget::Delicious

  # Add "Manage Bloglines Subscription of this feed" Widget
  – module: Widget::BloglinesSubscription

  # Send HTML email to your Gmail account using external SMTP server
  – module: Publish::Gmail
    config:
      mailto:   [username]@gmail.com
      mailfrom: hoge@hoge.com
      mailroute:
        via: sendmail
        host: /usr/sbin/sendmail

これでOK!!
実行は、以下の用に行う。

plagger -c bloglines2gmail.yaml

とここで、エラーが発生

Plagger::Plugin [fatal] file error – gmail_notify.tt: not found at line 144

と表示されてしう。
調べたところ、yamlファイルの他にGMAILに送信するにはgmail_notify.ttが必要
なようだ。

ということで、

mkidr -p assets/common
cp ./build/Plagger-0.7.17/assets/plugins/Publish-Gmail/gmail_notify.tt ./assets/common
 

で、設定ファイルにgmail_notify.ttのある場所を記述してやる。
bloglines2gmail.yamlの最初の方に下記を追加してやる。

global:
  assets_path: /home/[username]/plagger/assets #追加部分

で再度実行

plagger -c bloglines2gmail.yaml

これで、Bloglinesの記事がGMAILに送信される!!
便利。



Popularity: 2% [?]

DiggGoogle BookmarksGoogle ReaderFacebookDeliciousFriendFeedEvernoteTwitterShare
  1. No comments yet.

  1. No trackbacks yet.