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