Sha256: ac34c3627c1fb3dd1a3b2d730d6dfef3eafadd1de25b265761d1fadb28cf7824
Contents?: true
Size: 1.09 KB
Versions: 8
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby require 'thor' require 'pathname' require 'yaml' require 'ostruct' 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_file = nil [ './rget.yaml', '~/.rget', "#{Pathname(__dir__)}/../rget.yaml", ].each do |file| path = Pathname(file).expand_path if path.exist? config_file = path.to_s break end end unless config_file $stderr.puts 'config file not found' exit 1 end config = YAML::load_file(config_file) config['programs'].each do |command, params| desc command, params['desc'] define_method(command) do url = params['url'] opts = OpenStruct.new(config['options'].merge(options)) begin if params['podcast'] Podcast.new(url, opts){|media|media.download(params['label'])} else WebRadio(url, opts){|media|media.download(params['label'])} end rescue WebRadio::NotFoundError => e $stderr.puts e.message end end end end GetWebRadio.start(ARGV)
Version data entries
8 entries across 8 versions & 1 rubygems
Version | Path |
---|---|
rget-2.4.0 | bin/rget |
rget-2.3.9 | bin/rget |
rget-2.3.8 | bin/rget |
rget-2.3.7 | bin/rget |
rget-2.3.6 | bin/rget |
rget-2.3.5 | bin/rget |
rget-2.3.4 | bin/rget |
rget-2.3.3 | bin/rget |