Advertisement
Kolpa

own3d online reader

Apr 27th, 2012
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. function show(i)
  2. moni.setTextScale(3)
  3. moni.clear()
  4. moni.setCursorPos(1,1)
  5. if i == 0 then
  6. moni.write("Stream OFF")
  7. else
  8. moni.write("Stream ON")
  9. end
  10. end
  11.  
  12. local tArgs = { ... }
  13. if #tArgs < 2 then
  14.     print( "Usage: <id> <monitor place>" )
  15.     return
  16. end
  17. term.clear()
  18. term.setCursorPos(1,1)
  19. print("Programm Running")
  20. moni = peripheral.wrap(tArgs[2])
  21.  
  22. while true do
  23. local page = http.get("http://api.own3d.tv/liveCheck.php?live_id="..tArgs[1])
  24.  
  25. if page ~= nil then
  26. local ownd = page:readAll()
  27. if string.sub(ownd, 64, 67) == "true" then
  28. show(1)
  29. else
  30. show(0)
  31. end
  32. sleep(60)
  33. else
  34. print("problems reading the status")
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement