summaryrefslogtreecommitdiff
path: root/sample/rss
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-16 08:04:50 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-16 08:04:50 +0000
commit4afc07a66637ab4df52f1b4672adf51b56b6c1eb (patch)
tree6e7393c5aaf28f28d54010007aa3ab43d64500cf /sample/rss
parentb51cd234cf7840c80cc9a78e487ee884af0c67d4 (diff)
* sample/rss/tdiary_plugin/rss-recent.rb (rss_recent_cache_rss):
use the first date information of items as site date information if channel doesn't have date information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/rss')
-rw-r--r--sample/rss/tdiary_plugin/rss-recent.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/sample/rss/tdiary_plugin/rss-recent.rb b/sample/rss/tdiary_plugin/rss-recent.rb
index f574135..7e6aad5 100644
--- a/sample/rss/tdiary_plugin/rss-recent.rb
+++ b/sample/rss/tdiary_plugin/rss-recent.rb
@@ -109,15 +109,7 @@ def rss_recent_cache_rss(url, cache_file, cache_time)
rescue ::RSS::UnknownConversionMethodError
end
- rss_recent_pubDate_to_dc_date(rss.channel)
- rss_infos = [
- [
- rss.channel.title,
- rss.channel.link,
- rss.channel.dc_date,
- rss.image && rss.image.url,
- ]
- ]
+ rss_infos = []
rss.items.each do |item|
rss_recent_pubDate_to_dc_date(item)
if item.respond_to?(:image_item) and item.image_item
@@ -127,6 +119,14 @@ def rss_recent_cache_rss(url, cache_file, cache_time)
end
rss_infos << [item.title, item.link, item.dc_date, image]
end
+ rss_recent_pubDate_to_dc_date(rss.channel)
+ rss_infos.unshift([
+ rss.channel.title,
+ rss.channel.link,
+ rss.channel.dc_date ||
+ rss.items.collect{|item| item.dc_date}.compact.first,
+ rss.image && rss.image.url,
+ ])
rss_recent_write_to_cache(cache_file, rss_infos)
rescue URI::InvalidURIError