Sha256: 626ad804bfcbc3d274cfef0f19ded52055acc0fca5d839ee6a6e2e24297382f0
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
#!/usr/bin/env ruby require 'thor' require 'pathname' require 'yaml' require 'webradio' require 'podcast' class GetWebRadio < Thor class_option :mp3, type: :boolean, default:true, desc:'convert to mp3 with ffmpeg' class_option :path, type: :string, desc:'store path (accept "dropbox://~")' config = nil [ './rget.yaml', '~/.rget', "#{Pathname(__dir__)}/../rget.yaml", ].each do |file| path = Pathname(file).expand_path if path.exist? config = path.to_s break end end unless config $stderr.puts 'config file not found' exit 1 end YAML::load_file(config)['programs'].each do |command, params| desc command, params['desc'] define_method(command) do if params['podcast'] podcast(params['url'], params['label']) else process(params['url'], params['label']) end end end private def process(uri, label) WebRadio(uri, options) do |radio| radio.download(label) end end def podcast(uri, label = nil) Podcast.new(uri, options) do |pod| pod.download(label) end end end GetWebRadio.start(ARGV)
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rget-2.2.4 | bin/rget |
rget-2.2.3 | bin/rget |
rget-2.2.2 | bin/rget |
rget-2.2.1 | bin/rget |
rget-2.2.0 | bin/rget |