bug fixes for iqdb
This commit is contained in:
@@ -7,7 +7,7 @@ module Iqdb
|
||||
end
|
||||
|
||||
def process(&block)
|
||||
IO.popen("iqdb #{database}", "w", &block)
|
||||
IO.popen("iqdb command #{database}", "w", &block)
|
||||
end
|
||||
|
||||
def add(post)
|
||||
|
||||
@@ -13,7 +13,7 @@ module Iqdb
|
||||
end
|
||||
|
||||
def open
|
||||
@socket = TCPSocket.new(hostname, port)
|
||||
@socket = TCPSocket.open(hostname, port)
|
||||
end
|
||||
|
||||
def close
|
||||
@@ -31,13 +31,17 @@ module Iqdb
|
||||
request do
|
||||
hex = post.id.to_s(16)
|
||||
socket.puts "add 0 #{hex}:#{post.preview_file_path}"
|
||||
socket.puts "done"
|
||||
socket.read
|
||||
end
|
||||
end
|
||||
|
||||
def remove(post_id)
|
||||
request do
|
||||
hext = post_id.to_s(16)
|
||||
hex = post_id.to_s(16)
|
||||
socket.puts "remove 0 #{hex}"
|
||||
socket.puts "done"
|
||||
socket.read
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1282,7 +1282,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def update_iqdb_async
|
||||
if Danbooru.config.iqdb_hostname_and_port
|
||||
if Danbooru.config.iqdb_hostname_and_port && File.exists?(preview_file_path)
|
||||
Danbooru.config.all_server_hosts.each do |host|
|
||||
delay(:queue => host).update_iqdb
|
||||
end
|
||||
@@ -1290,7 +1290,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def remove_iqdb_async
|
||||
if Danbooru.config.iqdb_hostname_and_port
|
||||
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)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user