Fix CLI options

This commit is contained in:
Omar Roth 2018-03-04 11:17:46 -06:00
parent 3cd66d2e7c
commit be6ced202c

View file

@ -26,7 +26,7 @@ yt_wait = 1.0
Kemal.config.extra_options do |parser| Kemal.config.extra_options do |parser|
parser.banner = "Usage: invidious [arguments]" parser.banner = "Usage: invidious [arguments]"
parser.on("-yp SIZE", "--youtube-pool=SIZE", "Number of clients in youtube pool (default: #{yt_pool_size})") do |number| parser.on("-p SIZE", "--youtube-pool=SIZE", "Number of clients in youtube pool (default: #{yt_pool_size})") do |number|
begin begin
yt_pool_size = number.to_i yt_pool_size = number.to_i
rescue ex rescue ex
@ -34,7 +34,7 @@ Kemal.config.extra_options do |parser|
exit exit
end end
end end
parser.on("-yt THREADS", "--youtube-threads=THREADS", "Number of threads for crawling (default: #{yt_threads})") do |number| parser.on("-t THREADS", "--youtube-threads=THREADS", "Number of threads for crawling (default: #{yt_threads})") do |number|
begin begin
yt_threads = number.to_i yt_threads = number.to_i
rescue ex rescue ex
@ -42,7 +42,7 @@ Kemal.config.extra_options do |parser|
exit exit
end end
end end
parser.on("-yw SECONDS", "--youtube-wait=SECONDS", "Time to wait between youtube server requests (default: #{yt_wait})") do |number| parser.on("-w SECONDS", "--youtube-wait=SECONDS", "Time to wait between youtube server requests (default: #{yt_wait})") do |number|
begin begin
yt_wait = number.to_f64 yt_wait = number.to_f64
rescue ex rescue ex
@ -64,7 +64,7 @@ CONTEXT.add_options(
OpenSSL::SSL::Options::NO_SSL_V2 | OpenSSL::SSL::Options::NO_SSL_V2 |
OpenSSL::SSL::Options::NO_SSL_V3 OpenSSL::SSL::Options::NO_SSL_V3
) )
youtube_pool = Deque.new(yt_pool_size.to_i) do youtube_pool = Deque.new(yt_pool_size) do
make_client(YT_URL, CONTEXT) make_client(YT_URL, CONTEXT)
end end