Commit d9a97b022af3fa668cc3042b61cc13a7992646fc
1 parent
a1208ff0
Exists in
community_hub_submodule
ok face and twitter
Showing
3 changed files
with
10 additions
and
11 deletions
Show diff stats
facebook_stream/lib_facebook_stream.rb
| @@ -8,8 +8,9 @@ require 'json' | @@ -8,8 +8,9 @@ require 'json' | ||
| 8 | # BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' | 8 | # BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' |
| 9 | 9 | ||
| 10 | def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) | 10 | def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) |
| 11 | - | ||
| 12 | - #raise hub.id.inspect | 11 | + if pooling_time == nil |
| 12 | + pooling_time = 5 | ||
| 13 | + end | ||
| 13 | @graph = Koala::Facebook::API.new(token) | 14 | @graph = Koala::Facebook::API.new(token) |
| 14 | initialComments = [] | 15 | initialComments = [] |
| 15 | extractedComments = [] | 16 | extractedComments = [] |
| @@ -40,6 +41,7 @@ def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) | @@ -40,6 +41,7 @@ def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) | ||
| 40 | newComments.each{|comment| | 41 | newComments.each{|comment| |
| 41 | puts comment | 42 | puts comment |
| 42 | noosferoComment = Comment.new | 43 | noosferoComment = Comment.new |
| 44 | + noosferoComment.title = 'hub-message-facebook' | ||
| 43 | noosferoComment.source_id = hub.id | 45 | noosferoComment.source_id = hub.id |
| 44 | noosferoComment.body = comment | 46 | noosferoComment.body = comment |
| 45 | noosferoComment.author_id = author_id | 47 | noosferoComment.author_id = author_id |
lib/community_hub_plugin/hub.rb
| @@ -38,26 +38,22 @@ class CommunityHubPlugin::Hub < Folder | @@ -38,26 +38,22 @@ class CommunityHubPlugin::Hub < Folder | ||
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | def self.twitter_service(hub, action) | 40 | def self.twitter_service(hub, action) |
| 41 | - #raise hub.inspect | ||
| 42 | - #if self.twitter_enabled == false | ||
| 43 | author_id = 54 | 41 | author_id = 54 |
| 44 | if action==:start | 42 | if action==:start |
| 45 | thread = Thread.new { | 43 | thread = Thread.new { |
| 46 | - Twurl::Stream.run(hub, author_id, self.hashtags_twitter, File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', self.proxy_url) | ||
| 47 | - } unless@@twitter_thread_started | 44 | + Twurl::Stream.run(hub, author_id, hub.setting[:hashtags_twitter], File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', hub.setting[:proxy_url]) |
| 45 | + } unless@@twitter_thread_started | ||
| 48 | @@twitter_thread_started = true | 46 | @@twitter_thread_started = true |
| 49 | end | 47 | end |
| 50 | end | 48 | end |
| 51 | 49 | ||
| 52 | def self.facebook_service(hub, action) | 50 | def self.facebook_service(hub, action) |
| 53 | author_id = 54 | 51 | author_id = 54 |
| 54 | - page_id="mundoreagindo" | ||
| 55 | if action==:start | 52 | if action==:start |
| 56 | - #facebook_comments(page, author_id, page_id, pooling_time=5, token='CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') | ||
| 57 | - thread = Thread.new { | ||
| 58 | - facebook_comments(hub, author_id, self.facebook_page_id, self.pooling_time, self.facebook_access_token, self.proxy_url) | 53 | + thread = Thread.new { |
| 54 | + facebook_comments(hub, author_id, hub.setting[:facebook_page_id], hub.setting[:facebook_pooling_time], hub.setting[:facebook_access_token], hub.setting[:proxy_url]) | ||
| 59 | } unless@@facebook_thread_started | 55 | } unless@@facebook_thread_started |
| 60 | - @@facebook_thread_started = true | 56 | + @@facebook_thread_started = true |
| 61 | end | 57 | end |
| 62 | end | 58 | end |
| 63 | 59 |
tweeter_stream/lib/twurl/request_controller.rb
| @@ -23,6 +23,7 @@ module Twurl | @@ -23,6 +23,7 @@ module Twurl | ||
| 23 | comment_text = ic.iconv("@#{parsed["user"]["name"]} " + _('said') + ": #{parsed["text"]}" + ' ')[0..-2] | 23 | comment_text = ic.iconv("@#{parsed["user"]["name"]} " + _('said') + ": #{parsed["text"]}" + ' ')[0..-2] |
| 24 | print "#{comment_text}\n" | 24 | print "#{comment_text}\n" |
| 25 | comment = Comment.new | 25 | comment = Comment.new |
| 26 | + comment.title = 'hub-message-twitter' | ||
| 26 | comment.source_id = Stream.page.id | 27 | comment.source_id = Stream.page.id |
| 27 | comment.body = comment_text | 28 | comment.body = comment_text |
| 28 | comment.author_id = Stream.author_id | 29 | comment.author_id = Stream.author_id |