From 5d8c14a1d5731b4fd28caecce77520cdd6f3babc Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 29 Jun 2012 11:47:13 +0100 Subject: [PATCH] Added support for separate geo:lat and geo:long elements --- app/models/feed.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/models/feed.rb b/app/models/feed.rb index adfecc7..1ae394f 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -26,6 +26,8 @@ class Feed def get puts "Fetching feed: #{@url}" Feedzirra::Feed.add_common_feed_entry_element('georss:point', :as => :point) + Feedzirra::Feed.add_common_feed_entry_element('geo:lat', :as => :geo_lat) + Feedzirra::Feed.add_common_feed_entry_element('geo:long', :as => :geo_long) Feedzirra::Feed.add_common_feed_element('generator', :as => :generator) feed = Feedzirra::Feed.fetch_and_parse(@feed_url) @@ -38,8 +40,15 @@ class Feed :last_fetched => Time.now ) - feed.entries.each do |e| - latlng = e.point.split(' ') + feed.entries.each do |e| + + if e.geo_lat && e.geo_long + latlng = [e.geo_lat, e.geo_long] + elsif e.point + latlng = e.point.split(' ') + else + next + end attrs = { :title => e.title,