Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'mechanize'
- require 'yaml'
- debug = File.new("/tmp/ipcamera", "w+")
- device_.devdata_.each do |d, k|
- debug.print "#{d}: #{k}\n"
- end
- debug.close()
- c = WWW::Mechanize.new
- c.get("http://#{device_.devdata_[299]}") do |login_page|
- login_form = login_page.forms[0]
- login_form.username = device_.devdata_[114]
- login_form.password = device_.devdata_[115]
- login_response = login_form.submit
- if login_response.title == "Login"
- puts "Login Failed"
- else
- c.get("http://#{device_.devdata_[299]}/#{device_.devdata_[2]}") do |image|
- if image.header["Content-type"] == "image/jpeg"
- data_set(image.body)
- format_set('jpg')
- else
- puts "Failed to retrieve image, login may have failed"
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement