stub in support for iqdbs
This commit is contained in:
@@ -1690,36 +1690,56 @@ class Post < ActiveRecord::Base
|
||||
|
||||
module ClassMethods
|
||||
def remove_iqdb(post_id)
|
||||
Iqdb::Server.new(*Danbooru.config.iqdb_hostname_and_port).remove(post_id)
|
||||
Iqdb::Command.new(Danbooru.config.iqdb_file).remove(post_id)
|
||||
if Danbooru.config.aws_sqs_iqdb_url
|
||||
client = SqsService.new(Danbooru.config.aws_sqs_iqdb_url)
|
||||
client.send_message("remove\n#{post_id}")
|
||||
else
|
||||
Iqdb::Server.new(*Danbooru.config.iqdb_hostname_and_port).remove(post_id)
|
||||
Iqdb::Command.new(Danbooru.config.iqdb_file).remove(post_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_iqdb_async
|
||||
if Danbooru.config.iqdb_hostname_and_port && File.exists?(preview_file_path)
|
||||
Danbooru.config.all_server_hosts.each do |host|
|
||||
if has_tag?("ugoira")
|
||||
run_at = 10.seconds.from_now
|
||||
else
|
||||
run_at = Time.now
|
||||
end
|
||||
if File.exists?(preview_file_path)
|
||||
if Danbooru.config.aws_sqs_iqdb_url
|
||||
client = SqsService.new(Danbooru.config.aws_sqs_iqdb_url)
|
||||
client.send_message("update\n#{id}\n#{preview_url}")
|
||||
elsif Danbooru.config.iqdb_hostname_and_port
|
||||
Danbooru.config.all_server_hosts.each do |host|
|
||||
if has_tag?("ugoira")
|
||||
run_at = 10.seconds.from_now
|
||||
else
|
||||
run_at = Time.now
|
||||
end
|
||||
|
||||
delay(:queue => host, :run_at => run_at).update_iqdb
|
||||
delay(:queue => host, :run_at => run_at).update_iqdb
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def remove_iqdb_async
|
||||
if Danbooru.config.iqdb_hostname_and_port && File.exists?(preview_file_path)
|
||||
Danbooru.config.all_server_hosts.each do |host|
|
||||
Post.delay(:queue => host).remove_iqdb(id)
|
||||
if File.exists?(preview_file_path)
|
||||
if Danbooru.config.aws_sqs_iqdb_url
|
||||
client = SqsService.new(Danbooru.config.aws_sqs_iqdb_url)
|
||||
client.send_message("remove\n#{id}")
|
||||
elsif Danbooru.config.iqdb_hostname_and_port
|
||||
Danbooru.config.all_server_hosts.each do |host|
|
||||
Post.delay(:queue => host).remove_iqdb(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_iqdb
|
||||
Iqdb::Server.new(*Danbooru.config.iqdb_hostname_and_port).add(self)
|
||||
Iqdb::Command.new(Danbooru.config.iqdb_file).add(self)
|
||||
if Danbooru.config.aws_sqs_iqdb_url
|
||||
client = SqsService.new(Danbooru.config.aws_sqs_iqdb_url)
|
||||
client.send_message("update\n#{id}\n#{preview_url}")
|
||||
else
|
||||
Iqdb::Server.new(*Danbooru.config.iqdb_hostname_and_port).add(self)
|
||||
Iqdb::Command.new(Danbooru.config.iqdb_file).add(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -455,6 +455,13 @@ module Danbooru
|
||||
def listbooru_auth_key
|
||||
end
|
||||
|
||||
# iqdbs options
|
||||
def iqdbs_auth_key
|
||||
end
|
||||
|
||||
def iqdbs_server
|
||||
end
|
||||
|
||||
# google api options
|
||||
def google_api_project
|
||||
end
|
||||
@@ -465,11 +472,9 @@ module Danbooru
|
||||
|
||||
# AWS config options
|
||||
def aws_access_key_id
|
||||
nil
|
||||
end
|
||||
|
||||
def aws_secret_access_key
|
||||
nil
|
||||
end
|
||||
|
||||
def aws_ses_enabled?
|
||||
@@ -478,7 +483,6 @@ module Danbooru
|
||||
|
||||
def aws_ses_options
|
||||
# {:smtp_server_name => "smtp server", :user_name => "user name", :ses_smtp_user_name => "smtp user name", :ses_smtp_password => "smtp password"}
|
||||
nil
|
||||
end
|
||||
|
||||
def aws_s3_enabled?
|
||||
@@ -504,5 +508,8 @@ module Danbooru
|
||||
|
||||
def aws_sqs_region
|
||||
end
|
||||
|
||||
def aws_sqs_iqdb_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user