lib/roku_builder/inspector.rb in roku_builder-3.12.8 vs lib/roku_builder/inspector.rb in roku_builder-3.13.0
- old
+ new
@@ -52,26 +52,28 @@
path = "/plugin_inspect"
conn = multipart_connection
payload = {
mysubmit: "Screenshot",
passwd: @dev_password,
- archive: Faraday::UploadIO.new("/dev/null", 'application/octet-stream')
+ archive: Faraday::UploadIO.new(File::NULL, 'application/octet-stream')
}
response = conn.post path, payload
path = /<img src="([^"]*)">/.match(response.body)
return false unless path
path = path[1]
unless out_file
- out_file = /time=([^"]*)">/.match(response.body)
- out_file = "dev_#{out_file[1]}.jpg" if out_file
+ out_time = /time=([^"]*)">/.match(response.body)
+ out_ext = /dev.([^"]*)\?/.match(response.body)
+ out_file = "dev_#{out_time[1]}.#{out_ext[1]}" if out_time and out_ext
+ out_file = "dev.jpg" unless out_file
end
conn = simple_connection
response = conn.get path
- File.open(File.join(out_folder, out_file), "w") do |io|
+ File.open(File.join(out_folder, out_file), "wb") do |io|
io.write(response.body)
end
@logger.info "Screen captured to #{File.join(out_folder, out_file)}"
return response.success?
end