Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def refresh_feeds
- @channels.each do |channel|
- feeds = Feed.find(:all, :conditions => ["disable = 0 and channel_id = ?", channel.id])
- feeds.each do |feed|
- black_csv = feed.filter_exclude
- black_list = black_csv ? black_csv.downcase.split /[\s,]+/ : []
- items = SimpleRSS.parse(open(feed.rss)).items rescue continue
- items.reject do |item|
- item.title.downcase.split( /\W+/ ).any? {|word| black_list.include? word }
- end.each do |item|
- checksum = item.link.hash
- entry = Entry.find(:first, :conditions => ["checksum = ? and feed_id = ?", checksum.to_s, feed.id])
- entry = Entry.create :feed_id => feed.id, :title => item.title, :link => item.link,
- :description => item.description, :checksum => checksum unless entry
- end
- end
- end
- flash[:notice] = "Retrieval completed."
- end
Add Comment
Please, Sign In to add comment