implement iqdb wrapper

This commit is contained in:
r888888888
2014-03-21 16:43:02 -07:00
parent 0add72f2bd
commit 16712b7d56
24 changed files with 335 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
module Iqdb
class Download
attr_reader :source, :download, :similar_posts
def initialize(source)
@source = source
end
def download_from_source
tempfile = Tempfile.new("iqdb-#{$PROCESS_ID}")
@download = Downloads::File.new(source, tempfile.path)
@download.download!
end
def find_similar
if Danbooru.config.iqdb_hostname_and_port
@similar_posts = Iqdb::Server.new(*Danbooru.config.iqdb_hostname_and_port).query(0, 3, @download.file_path)
end
end
end
end