瀏覽代碼

Added support for separate geo:lat and geo:long elements

master
Adrian Short 12 年之前
父節點
當前提交
5d8c14a1d5
共有 1 個文件被更改,包括 11 次插入2 次删除
  1. +11
    -2
      app/models/feed.rb

+ 11
- 2
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,


Loading…
取消
儲存