Sha256: 6ff649962d82914be1618f1141e6cedb1e993dbbcdbfb648ac9450b92ba76418
Contents?: true
Size: 765 Bytes
Versions: 4
Compression:
Stored size: 765 Bytes
Contents
require 'webradio' require 'open3' class HLS < WebRadio private def hls_download(name, serial, m3u_meta, headers = {}) mp4_file = "#{name}##{serial}.mp4" mp3_file = "#{name}##{serial}.mp3" m3u = URI.open(m3u_meta, headers, &:read).scan(/^[^#].*/).first m3u = Pathname(m3u_meta).dirname.join(m3u) if Pathname(m3u).relative? ffmpeg_headers = headers.empty? ? '' : "-headers '" + headers.map{|k, v| "#{k}: #{v}"}.join("\r\n") + "'" mp3nize(mp4_file, mp3_file) do result = Open3.capture3(%Q[ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto #{ffmpeg_headers} -i "#{m3u}" "#{mp4_file}"]) unless result[2].to_i == 0 raise WebRadio::DownloadError.new("failed download the radio program (#{@label}).") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rget-4.14.0 | lib/hls.rb |
rget-4.13.2 | lib/hls.rb |
rget-4.13.1 | lib/hls.rb |
rget-4.13.0 | lib/hls.rb |