From 91a091747794cb9c8ee6ddfe27bf00b3be0bcc2c Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 24 Mar 2014 15:07:13 -0700 Subject: [PATCH] fix iqdb importer --- app/logical/iqdb/importer.rb | 7 +++++-- script/fixes/029_iqdb_import.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/logical/iqdb/importer.rb b/app/logical/iqdb/importer.rb index 79b117e1f..f71162a20 100644 --- a/app/logical/iqdb/importer.rb +++ b/app/logical/iqdb/importer.rb @@ -1,12 +1,15 @@ module Iqdb class Importer def import! - IO.popen("iqdb add #{Rails.root}/danbooru.db", "w") do |io| + IO.popen("iqdb command #{Danbooru.config.iqdb_file}", "w") do |io| Post.find_each do |post| if File.exists?(post.preview_file_path) - io.puts "#{post.id.to_s(16)}:#{post.preview_file_path}" + puts post.id + hex = post.id.to_s(16) + io.puts "add 0 #{hex} :#{post.preview_file_path}" end end + io.puts "quit" end end end diff --git a/script/fixes/029_iqdb_import.rb b/script/fixes/029_iqdb_import.rb index 3f4da8b08..a06a64071 100644 --- a/script/fixes/029_iqdb_import.rb +++ b/script/fixes/029_iqdb_import.rb @@ -2,4 +2,4 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')) -Iqdb::Server.import(Danbooru.config.iqdb_file) +Iqdb::Importer.import!