iqdb command fixes
This commit is contained in:
@@ -7,7 +7,7 @@ module Iqdb
|
|||||||
end
|
end
|
||||||
|
|
||||||
def process(&block)
|
def process(&block)
|
||||||
IO.popen("iqdb command #{database}", "w", &block)
|
IO.popen("iqdb command #{database}", "w+", &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add(post)
|
def add(post)
|
||||||
@@ -15,6 +15,7 @@ module Iqdb
|
|||||||
process do |io|
|
process do |io|
|
||||||
io.puts "add 0 #{hex}:#{post.preview_file_path}"
|
io.puts "add 0 #{hex}:#{post.preview_file_path}"
|
||||||
io.puts "quit"
|
io.puts "quit"
|
||||||
|
io.read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ module Iqdb
|
|||||||
process do |io|
|
process do |io|
|
||||||
io.puts "remove 0 #{hex}"
|
io.puts "remove 0 #{hex}"
|
||||||
io.puts "quit"
|
io.puts "quit"
|
||||||
|
io.read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
module Iqdb
|
module Iqdb
|
||||||
class Importer
|
class Importer
|
||||||
def import!
|
def import!
|
||||||
Post.find_each do |post|
|
Post.where("created_at >= ?", 3.months.ago).find_each do |post|
|
||||||
IO.popen("iqdb command #{Danbooru.config.iqdb_file}", "w") do |io|
|
IO.popen("iqdb command #{Danbooru.config.iqdb_file}", "w+") do |io|
|
||||||
if File.exists?(post.preview_file_path)
|
if File.exists?(post.preview_file_path)
|
||||||
puts post.id
|
puts post.id
|
||||||
hex = post.id.to_s(16)
|
hex = post.id.to_s(16)
|
||||||
io.puts "add 0 #{hex}:#{post.preview_file_path}"
|
io.puts "add 0 #{hex}:#{post.preview_file_path}"
|
||||||
end
|
end
|
||||||
io.puts "quit"
|
io.puts "quit"
|
||||||
|
io.read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user