pull-english: improve

This commit is contained in:
0x1eef 2022-07-15 18:14:34 -03:00
parent 64356477f6
commit d9eb895c1f
2 changed files with 9 additions and 4 deletions

View file

@ -43,17 +43,21 @@ http.use_ssl = true
1.upto(114) do |chapter|
rows = []
vcount = vmap[chapter.to_s]
line.rewind.print("Download chapter #{chapter}:").end
1.upto(vcount) do |verse|
line.rewind.print("Download: #{verse}/#{vcount}")
line.rewind.print("#{verse} of #{vcount} verses downloaded. ")
res = http.request_get("/#{chapter}/#{verse}")
if Net::HTTPOK === res
rows.push([verse, find_content.(res)])
else
line.end.print(Paint["Error: ", :red, :bold], res.class).end
line.end.print(Paint["ABORT", :red, :bold])
.end.print("Bad response: ", res.class)
.end
exit(1)
end
sleep delay
sleep(delay)
end
File.write(format(dest, chapter:), JSON.pretty_generate(rows))
line.end.print(Paint["OK", :green, :bold]).end
line.end.print(Paint["Done.", :bold])
.end.end
end

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class IO::Line
require "io/console"
attr_reader :io
def initialize(io)