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

@@ -9,6 +9,8 @@ class Post < ActiveRecord::Base
after_save :create_version
after_save :update_parent_on_save
after_save :apply_post_metatags, :on => :create
# after_save :update_iqdb, :on => :create
# after_destroy :remove_iqdb
before_save :merge_old_changes
before_save :normalize_tags
before_save :update_tag_post_counts
@@ -1268,6 +1270,20 @@ class Post < ActiveRecord::Base
end
end
end
module IqdbMethods
def update_iqdb
Danbooru.config.all_server_hosts.each do |host|
Iqdb::Server.delay(:queue => host).add(Danbooru.config.iqdb_file, id, preview_file_path)
end
end
def remove_iqdb
Danbooru.config.all_server_hosts.each do |host|
Iqdb::Server.delay(:queue => host).remove(Danbooru.config.iqdb_file, id)
end
end
end
include FileMethods
include ImageMethods