July 21, 2005

MT4iバージョンアップ

携帯でMTを閲覧すると "~" が文字化けするので、MT4iを「Tonkey氏」版から「talk to oneself氏」版に変更しました。サーバに Encode.pm がインストールされていることが条件です。

・ファイル「mt4imgr.cgi」、ディレクトリ(フォルダ)「mt4ilib」をサーバーにアップロード(既存のmt4i.cgiと同階層に置くこと、「mt4i.cgi」はまだアップロードしないので注意)。
・「mt4imgr.cgi」のパーミッションを「705」あるいはプロバイダ等で指定されているCGIプログラムを動かす際のパーミッション値に変更。
・Webブラウザより「mt4imgr.cgi」にアクセスし、パスワードを入力してログイン。
・上部に表示される「v1.82β1以前の設定を読み込む。」リンクをクリック。
・mt4iのファイル名をデフォルトの「mt4i.cgi」から変更している場合は、ファイル名の入力を求められるので入力。
・設定が読み込まれる。設定を編集するならして、保存。
・「mt4i.cgi」をサーバーにアップロード(「mt4imgr.cgi」と同階層に置くこと。また、ファイル名の変更も必要ならやる。前バージョンを上書きするなら、バックアップを取っておくことをオススメ)。
・「mt4i.cgi」のパーミッションを「705」あるいは適当な値に変更。
・Webブラウザより「mt4i.cgi」にアクセスして動作確認。

■懸案事項
・記事投稿、修正時にPing送信エラーの場合 Internal Server Erorr となる。
・①,②,③・・・等、まだ文字化けが直らないワードがある。

投稿者 hare : 7:30 PM | コメント (0) | トラックバック

February 23, 2005

MT4i Link

MT4i Link
MT4iは、MovableTypeというBlogツールで作られたBlogを携帯電話などモバイル機器で、閲覧、編集できるようにしたソフトです。MT4i自体の操作性などはよいのですが、アドレスの入力、Blog間の連携などには問題が残っていました。 そこで、リンク集を作って、相互利用を促進しようというのが、「MT4i Link」です。現在、Ping受信、日付表示機能などのついた ver.2 が稼働しています。
MT4iを使わせて頂いているので、MT4i Linkに早速登録してみました。僕は108件目のMT4i Link登録者でした。 MT4i Link:http://tsukihito.zive.net/l/

投稿者 hare : 6:40 PM | コメント (0) | トラックバック

November 12, 2004

mail2entry

■mail2entry
当サーバー(Vine Linux)では「 mail2entry」 を使用して moblog を実現してみました。
「 mail2entry」を使うことによって、モバイル機器から簡単に記事の投稿などが実現できます。
「 mail2entry」 は、「physon」と言うプログラム言語で書かれていたので、動作させるまでに苦戦しました。

まず、Mail2Entry からソースをダウンロードします。

$ fetch http://www.gweep.net/~aron/mail2entry/mail2entry20030506.tar.gz

つぎに、python がインストールされているか確認します。バージョンは 2.2.2 以上である必要があります。

$ which python
/usr/local/bin/python

Python Unicode codecs for Japanese charsets をインストールしなくてはなりません。
これは JapaneseCodecs からダウンロードできます。
http://www.python.jp/Zope/download/JapaneseCodecsより
”JapaneseCodecs-1.4.10.tar.gz” をダウンロード

> tar zxvf JapaneseCodecs-1.4.10.tar.gz
> cd JapaneseCodecs-1.4.10
> su -m
# /usr/local/bin/python setup.py install

これで python の準備はOKです。
つづいて mail2entry 本体のインストールと設定です。ダウンロードしておいたファイルを展開します。

$ tar xvzf mail2entry20030506.tar.gz
mail2entry20030506/
mail2entry20030506/parsemsg.py
mail2entry20030506/COPYING
mail2entry20030506/INSTALL
mail2entry20030506/README
mail2entry20030506/mail2entry.py
mail2entry20030506/postentry.py
mail2entry20030506/postimage.py
mail2entry20030506/saveimage.py
mail2entry20030506/settings.py

このディレクトリはどこに置いてもよいのですが、私は MT 下においています。

$ mv mail2entry20030506 /$MT/plugins/mail2entry

/$MT/ は mt.cgi のあるディレクトリです。次に settings.py を書き換えます。

> cat settings.py
"""Profile settings"""

# username: The name of an existing user for your Movable Type weblog.
# You probably want to create an account separate from your
# principle weblog user.
username = "username"

# password: The password associated with the above username.
password = "password"

# blogid: The id of your Movable Type weblog. You can determine this id
# by looking for the value in the "blog_id" CGI variable in the
# Movable Type configuration URLs.
blogid = 1

# publish: Boolean (either True or False) which forces the publication
# of the new weblog entry. If False, the new entry will be
# queued until it is manually published.
publish = True

# savelocal: Boolean (either True of False) which determines if the images
# are to be saved locally. If False, the image is uploaded to
# your weblog through the newMediaObject XML-RPC API.
savelocal = False

# url: Pointer to the XML-RPC interface for your weblog. There is no
# requirement that your weblog must reside on the same server
# as the images are stored.
uri = "http://YourDomain/~YourName/mt/mt-xmlrpc.cgi"

# imagesdirpath: Path to where images will be stored. If _savelocal_ is
# True, this is an absolute path on the local server. If
# False, the path is relative to your weblog directory.
imagesdirpath = "images/moblog_images"

# imageurldir: URL pointing to the web location for the resulting images.
# If the images are on the same server as your weblog, you need
# only specify the path portion of the URL (protocol and host are
# unnecessary). If _savelocal_ is True, this variable is unused
# (the weblog determines the final location of the image).
imageurldir = "http://YourDomain/~YourName/mt/images/moblog_images"

# template: Template for the resulting blog entry. You probably don't
# need to change this.
template = "<div class=\"caption\">%(caption)s</div>\n" + \
"<div class=\"photo\">%(imagecontent)s</div>"

# imgtemplate: Template for a single image entry. This gets embedded
# within _template_ when creating the full entry. If multiple
# images are found within an email message, _imgtemplate_ will
# be used for each image. The concatenation of all _imgtemplate_
# are used within _template_.
imgtemplate = "<img src=\"%(imageurl)s\">"

# logfilepath: Log file containing details of any errors (Python exceptions)
# which occur. New errors are appended to the end of this file.
# It needs to be writable by whatever user runs the mail2entry
# script.
logfilepath = "./log-tracebacks.log"

テストします。

$ cat file | python /path/to/mail2entry.py ./

file には適当な短いファイルを指定します。このファイルの内容が新しいエントリとしてテストに使われます。/path/to の部分は適宜読み替えてください。私の場合は /$MT/plugins/mail2entry/mail2entry.py になりますね。mail2entry.py の引数は mail2entry の置かれているディレクトリを指定します。私の場合は /$MT/plugins/mail2entry/ になりますが、今はこのディレクトリ内にいるということを仮定しているので、./ としています。
これでうまくいっていれば新しい blog に新しいエントリが作製されているはずです。何かうまくいっていない場合、logfilepath に指定したところにログができているのでそれを見て対処してください。

メールからデータを受け取り、スクリプトを起動してエントリを書き込むpostfixでの設定です。
aliases に :include: を使用して実現しています。:include: を使用せずに、直接 aliases 内にパイプでmail2entryに渡してもよいのですが、そうすると作製されるログなどの Owner がpostfixの実行ユーザになったりするので(設定によって異なります)、:include:をたたいています。
 まず、実行するファイルを用意します。引き続き、/$MT/plugins/mail2entry/ 内にいるとして、

$ vi include
"| /usr/local/bin/python /$MT/plugins/mail2entry/mail2entry.py /$MT/plugins/mail2entry/"

とします。最初と最後の " (ダブルクオーテーション) および | (パイプ) も必要です。

次に、ファイルの所有者とモードを変えておきます。

postfix のデフォルトの設定では、aliases 内に :include: を含むことを禁止しているので、 $postfix/main.cf 内に

allow_mail_to_commands = alias,forward,include

を追加して postfix を再起動します。

aliases を有効にします。

# cd /etc
# vi aliases
mail2entry: :include:/$MT/plugins/mail2entry/include

以上の行を追加します。一番最初の mail2entry というのはメールアドレスになるので好きなものを指定してください。この場合 mail2entry@example.com というアドレスが追加されたことになります。編集後は必ず newaliases を実行します。

# newaliases

これで終了です。何かおかしい場合、ファイルのパーミッションや、/tmp/log-trackbacks.log /var/log/maillog の内容などを調べてみてください。

投稿者 hare : 9:33 PM | コメント (3) | トラックバック

October 21, 2004

MT4i導入

携帯電話からも本サイトが読めるようにMT4i Version 1.8T7を導入しました。

携帯電話用のURLです。 http://cc.blogdns.com/cgi-bin/mt/mt4i.cgi
ただ携帯電話を持っていないのでテストがまだ出来ていません。今度誰かに借りて試験してみます。

banner_mt4i_nagasawa_01.gif

投稿者 hare : 4:57 PM | コメント (1) | トラックバック