enclosure内のファイル名が同じだと上書きされる件
プレイヤーズ王国のpodcastをSunscription::Configでとってきて
Filter::FetchEnclosureしてたんですが、
ローカルのフォルダを見るとdownload.mp3が1個あるだけでした。
本当なら5個のmp3ファイルが生成されるはず。
YAMLは以下のとおり。
plugins: - module: Subscription::Config config: feed: - url: http://players.music-eclub.com/players_podcasting/pickup.xml - module: Filter::FetchEnclosure config: dir: C:\players
調べてみるとどうやらFilter::FetchEnclosure内で呼び出してる、
Plagger::UserAgentのmirrorメソッドが原因ぽい。
Plagger::UserAgentの91行目らへん。
if (-e $file) { # Some dosish systems fail to rename if the target exists chmod 0777, $file; unlink $file; } rename($tmpfile, $file) or die "Cannot rename '$tmpfile' to '$file': $!\n";
どうやら取得したファイルと同じ名前のファイルが存在すると、
既存のファイルは削除されてしまうようです。
プレイヤーズ王国のpodcastはファイル名が全部download.mp3なので、
5つのmp3ファイルのうち最後のやつだけが残ってたということみたいですね。
とりあえず応急処置。
if (-e $file) { # Some dosish systems fail to rename if the target exists #chmod 0777, $file; #unlink $file; $file .= '_' . time; rename($tmpfile, $file) or die "Cannot rename '$tmpfile' to '$file': $!\n"; } else { rename($tmpfile, $file) or die "Cannot rename '$tmpfile' to '$file': $!\n"; }
ところでdosishてどういう意味だろう?