Permalink
Browse files

disabled Yahoo BOSS images

  • Loading branch information...
1 parent 725ec23 commit d95966931a323bbd410306b9b8a903dee2f1cf27 Pete Skomoroch committed Aug 1, 2011
Showing with 39 additions and 31 deletions.
  1. +30 −22 app/models/page.rb
  2. +9 −9 db/schema.rb
View
@@ -123,31 +123,39 @@ def news_snippet
def picture
- boss = BOSSMan::Search.images(self.title, { :filter => "-porn"})
- if boss.totalhits.to_i > 0
- result = boss.results[0]
- url = result.thumbnail_url
- else
- url = "White_square_with_question_mark.png"
- end
+ ## TODO: Yahoo Boss is deprecated, switch to Bing API
+ # boss = BOSSMan::Search.images(self.title, { :filter => "-porn"})
+ # if boss.totalhits.to_i > 0
+ # result = boss.results[0]
+ # url = result.thumbnail_url
+ # else
+ # url = "White_square_with_question_mark.png"
+ # end
+ url = "White_square_with_question_mark.png"
end
def picture_size(desired_height)
- boss = BOSSMan::Search.images(self.title, { :filter => "-porn"})
- if boss.totalhits.to_i > 0
- result = boss.results[0]
- height = result.thumbnail_height.to_i
- width = result.thumbnail_width.to_i
- width_scale_factor = 1.0*desired_height/height
- new_width = width_scale_factor*width
- "#{new_width.to_i}x#{desired_height.to_i}"
- else
- height = 120
- width = 120
- width_scale_factor = 1.0*desired_height/height
- new_width = width_scale_factor*width
- "#{new_width.to_i}x#{desired_height.to_i}"
- end
+ ## TODO: Yahoo Boss is deprecated, switch to Bing API
+ # boss = BOSSMan::Search.images(self.title, { :filter => "-porn"})
+ # if boss.totalhits.to_i > 0
+ # result = boss.results[0]
+ # height = result.thumbnail_height.to_i
+ # width = result.thumbnail_width.to_i
+ # width_scale_factor = 1.0*desired_height/height
+ # new_width = width_scale_factor*width
+ # "#{new_width.to_i}x#{desired_height.to_i}"
+ # else
+ # height = 120
+ # width = 120
+ # width_scale_factor = 1.0*desired_height/height
+ # new_width = width_scale_factor*width
+ # "#{new_width.to_i}x#{desired_height.to_i}"
+ # end
+ height = 120
+ width = 120
+ width_scale_factor = 1.0*desired_height/height
+ new_width = width_scale_factor*width
+ "#{new_width.to_i}x#{desired_height.to_i}"
end
View
@@ -11,6 +11,15 @@
ActiveRecord::Schema.define(:version => 20100316042802) do
+ create_table "backup_hourly_trends", :force => true do |t|
+ t.float "hourly_trend"
+ t.integer "page_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "backup_hourly_trends", ["page_id", "hourly_trend"], :name => "hourly_trend_index"
+
create_table "companies", :force => true do |t|
t.integer "page_id"
t.datetime "created_at"
@@ -98,15 +107,6 @@
add_index "new_hourly_timelines", ["page_id"], :name => "hourly_timelines_page_index"
- create_table "new_hourly_trends", :force => true do |t|
- t.float "hourly_trend"
- t.integer "page_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "new_hourly_trends", ["page_id", "hourly_trend"], :name => "hourly_trend_index"
-
create_table "new_pages", :force => true do |t|
t.string "url"
t.string "title"

0 comments on commit d959669

Please sign in to comment.