diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-12-18 14:19:08 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-12-18 14:19:08 +0000 |
commit | 5dd9e721c8c61f4caadb6c72ad30bc9ff809e489 (patch) | |
tree | 009434d16fe1ac5cb2e36b786229ebb969d0a421 /lib | |
parent | 558b007a39ac7f568a705e076db4e8a458494064 (diff) | |
download | feed2imap-5dd9e721c8c61f4caadb6c72ad30bc9ff809e489.tar.gz feed2imap-5dd9e721c8c61f4caadb6c72ad30bc9ff809e489.tar.bz2 feed2imap-5dd9e721c8c61f4caadb6c72ad30bc9ff809e489.zip |
per-feed dumpdir option
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@120 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/config.rb | 3 | ||||
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index 3aea4bb..4c3a858 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -72,7 +72,7 @@ end # A configured feed. simple data container. class ConfigFeed - attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash + attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir attr_accessor :body def initialize(f, imapaccount, folder) @@ -86,6 +86,7 @@ class ConfigFeed @filter = f['filter'] @ignore_hash = f['ignore-hash'] || false @freq = @freq.to_i if @freq + @dumpdir = f['dumpdir'] || nil end def needfetch(lastcheck) diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb index a2474be..fcb483e 100644 --- a/lib/feed2imap/feed2imap.rb +++ b/lib/feed2imap/feed2imap.rb @@ -149,6 +149,15 @@ class Feed2Imap end end end + # dump this feed if requested + if feed.dumpdir + mutex.synchronize do + if feed.body + fname = feed.dumpdir + '/' + feed.name + '-' + Time::now.xmlschema + File::open(fname, 'w') { |file| file.puts feed.body } + end + end + end rescue Timeout::Error mutex.synchronize do n = @cache.fetch_failed(feed.name) |