pull-english: improve
This commit is contained in:
parent
64356477f6
commit
d9eb895c1f
2 changed files with 9 additions and 4 deletions
|
@ -43,17 +43,21 @@ http.use_ssl = true
|
||||||
1.upto(114) do |chapter|
|
1.upto(114) do |chapter|
|
||||||
rows = []
|
rows = []
|
||||||
vcount = vmap[chapter.to_s]
|
vcount = vmap[chapter.to_s]
|
||||||
|
line.rewind.print("Download chapter #{chapter}:").end
|
||||||
1.upto(vcount) do |verse|
|
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}")
|
res = http.request_get("/#{chapter}/#{verse}")
|
||||||
if Net::HTTPOK === res
|
if Net::HTTPOK === res
|
||||||
rows.push([verse, find_content.(res)])
|
rows.push([verse, find_content.(res)])
|
||||||
else
|
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)
|
exit(1)
|
||||||
end
|
end
|
||||||
sleep delay
|
sleep(delay)
|
||||||
end
|
end
|
||||||
File.write(format(dest, chapter:), JSON.pretty_generate(rows))
|
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
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class IO::Line
|
class IO::Line
|
||||||
require "io/console"
|
require "io/console"
|
||||||
|
|
||||||
attr_reader :io
|
attr_reader :io
|
||||||
|
|
||||||
def initialize(io)
|
def initialize(io)
|
||||||
|
|
Loading…
Reference in a new issue