Skip to content

Instantly share code, notes, and snippets.

@vinhboy
Last active December 13, 2015 17:19
Show Gist options
  • Save vinhboy/4946994 to your computer and use it in GitHub Desktop.
Save vinhboy/4946994 to your computer and use it in GitHub Desktop.
require 'net/http/persistent'
url = URI.parse('http://10.0.1.10:7000')
http = Net::HTTP::Persistent.new 'my_app'
post_uri = url + '/play'
post = Net::HTTP::Post.new post_uri.path
post["User-Agent"] = "iTunes/11.0.1 (Macintosh; OS X 10.7.5) AppleWebKit/534.57.7"
post.body = "Content-Location: http://trailers.apple.com/movies/marvel/ironman3/ironman3-tlr1-m4mb0_h1080p.mov\nStart-Position: 0\n"
response = http.request post_uri, post
while true do
get_uri = url + '/scrub'
request = Net::HTTP::Get.new get_uri.path
request["User-Agent"] = "iTunes/11.0.1 (Macintosh; OS X 10.7.5) AppleWebKit/534.57.7"
response = http.request get_uri, request
puts response.body
sleep(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment