Sha256: ef20b661d288b47135241d418c45260c73287b6ecfa3d2973cad4c1ccab1bd05

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "quran/audio"
require "optparse"

##
# main
def main(argv)
  options = Ryo({
    recitation: "alafasy",
    bitrate: 128,
    surahs: (1..114),
    delay: 0.5
  })
  option_parser.parse(argv, into: options)
  Quran::Audio::Command::Pull.new(options).perform
end

##
# utils
def option_parser
  OptionParser.new do |o|
    o.banner = "Usage: quran-audio pull [OPTIONS]"
    o.on("-r RECITATION", "--recitation RECITATION", "A recitation's name", String)
    o.on("-b BITRATE"   , "--bitrate BITRATE", "MP3 bitrate", Integer)
    o.on("-s NUMBERS"   , "--surahs NUMBERS", "Comma-separated list of surah IDs", Array)
    o.on("-d SECONDS"   , "--delay", "Delay between requests, in seconds", Float)
  end
end

excode = catch(:abort) {
  main(ARGV)
  0
}
exit excode

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quran-audio-0.4.2 libexec/quran-audio/pull
quran-audio-0.4.1 libexec/quran-audio/pull
quran-audio-0.4.0 libexec/quran-audio/pull