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