summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Nichols <nichoj@gentoo.org>2006-08-21 02:03:02 +0000
committerJoshua Nichols <nichoj@gentoo.org>2006-08-21 02:03:02 +0000
commitdd855de69fdcbb474de0c4824691cd8ba966e8f4 (patch)
tree994bda08870f5973a56a6923cd9ff6da04c36553
parentUpdated Herds and UserInfo parsing (diff)
downloadnichoj-dd855de69fdcbb474de0c4824691cd8ba966e8f4.tar.gz
nichoj-dd855de69fdcbb474de0c4824691cd8ba966e8f4.tar.bz2
nichoj-dd855de69fdcbb474de0c4824691cd8ba966e8f4.zip
Adding back blog rss parsing. Needs some work to account for all possible blog types / possible errors
svn path=/; revision=57
-rwxr-xr-xprojects/devdashboard/devdashboard.rb2
-rw-r--r--projects/devdashboard/developer.rb24
-rwxr-xr-xprojects/devdashboard/planetiniparser.rb39
3 files changed, 52 insertions, 13 deletions
diff --git a/projects/devdashboard/devdashboard.rb b/projects/devdashboard/devdashboard.rb
index 0d02f0c..69cb4d4 100755
--- a/projects/devdashboard/devdashboard.rb
+++ b/projects/devdashboard/devdashboard.rb
@@ -24,6 +24,8 @@ include MetadataHelper
developers = UserInfo.indexUsers()
herds = Herds.indexHerds(developers)
+PlanetIniParser.updateDevs(developers)
+
developers.each do |email, dev|
dev.print
puts
diff --git a/projects/devdashboard/developer.rb b/projects/devdashboard/developer.rb
index 52ba3db..6dba1be 100644
--- a/projects/devdashboard/developer.rb
+++ b/projects/devdashboard/developer.rb
@@ -33,15 +33,23 @@ class Developer
end
def parseRssForItems(feed)
- items = nil
- open(feed) do |http|
- rss_source = http.read
- rss = RSS::Parser.parse(rss_source, true)
- if rss.nil?
- rss = RSS::Parser.parse(rss_source, true, false)
- end
- items = rss.items
+ items = []
+ begin
+ open(feed) do |http|
+ rss_source = http.read
+ rss = RSS::Parser.parse(rss_source, true)
+ if rss.nil?
+ rss = RSS::Parser.parse(rss_source, true, false)
+ end
+
+ unless rss.nil?
+ items = rss.items
+ end
+ end
+ # catch some errors that could occur
+ rescue SocketError, OpenURI::HTTPError, RSS::NotAvailableValueError
end
+
return items
end
def commitItems()
diff --git a/projects/devdashboard/planetiniparser.rb b/projects/devdashboard/planetiniparser.rb
index 051db56..72de77d 100755
--- a/projects/devdashboard/planetiniparser.rb
+++ b/projects/devdashboard/planetiniparser.rb
@@ -5,8 +5,8 @@ require 'pp'
module PlanetIniParser
- def PlanetIniParser.updateDev(developer)
- planetUri = "http://sources.gentoo.org/viewcvs.py/*checkout*/planet/configs/planet.ini?rev=176"
+ def PlanetIniParser.updateDevs(developers)
+ planetUri = "http://sources.gentoo.org/viewcvs.py/*checkout*/planet/configs/planet.ini"
open(planetUri) do |file|
while line = file.gets do
if line =~ /^\[(.*)\]$/
@@ -21,15 +21,44 @@ module PlanetIniParser
data[$1] = $2
end
- if data['username'] == developer.handle
- if ! data['face'].nil?
+ developer = developers["#{data['username']}@gentoo.org"]
+ unless developer.nil?
+ unless data['face'].nil?
developer.hackergotchi = "http://planet.gentoo.org/images/#{data['face']}"
end
+
developer.blogRss = url
end
+ end
end
end
+
end
-end
+# def PlanetIniParser.updateDev(developer)
+# planetUri = "http://sources.gentoo.org/viewcvs.py/*checkout*/planet/configs/planet.ini?rev=176"
+# open(planetUri) do |file|
+# while line = file.gets do
+# if line =~ /^\[(.*)\]$/
+# url = $1
+# next if url == "Planet" or url == "DEFAULT"
+#
+# data = {}
+# while line = file.gets do
+# line.chomp!
+# break if line == ""
+# line =~ /(.*) = (.*)/
+# data[$1] = $2
+# end
+#
+# if data['username'] == developer.handle
+# if ! data['face'].nil?
+# developer.hackergotchi = "http://planet.gentoo.org/images/#{data['face']}"
+# end
+# developer.blogRss = url
+# end
+# end
+# end
+# end
+
end