Advertisement
Guest User

HockeyUpdate

a guest
Oct 10th, 2013
1,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. --[[
  2. DISCLAIMER: SCRIPT IS PROVIDED AS IS USE AT YOUR OWN RISK!
  3.  
  4. Save this script as "hockey.lua"
  5. Place this script in:
  6. - Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\sd\
  7. - Windows (current user): %APPDATA%\VLC\lua\sd\
  8. - Linux (all users): /usr/share/vlc/lua/sd/
  9. - Linux (current user): ~/.local/share/vlc/lua/sd/
  10. - Mac OS X (all users): VLC.app/Contents/MacOS/share/lua/sd/
  11. --]]
  12. require "simplexml"
  13.  
  14. function descriptor()
  15. return { title="/r/hockey" }
  16. end
  17.  
  18. function main()
  19. local quality = {400, 800, 1200, 1600, 2400, 3000, 4500}
  20. local games = simplexml.parse_url("http://208.92.36.37/nlds/as3/get_games.php?client=nhl&playerclient=hop")
  21. for _, game in ipairs( games.children ) do
  22. if(game.name == "game") then
  23. simplexml.add_name_maps( game )
  24. local game_date = game.attributes["game_date"]
  25. local home_team = game.children_map['home_team'][1].children[1]
  26. local away_team = game.children_map['away_team'][1].children[1]
  27. local title = game_date .. " " .. away_team .. " @ " .. home_team
  28. local node = vlc.sd.add_node( { path = "", title = title } )
  29. for _, ass in ipairs(game.children_map['assignments'][1].children) do
  30. local feed = ass.attributes["feed_display_name"]
  31. local feed_title = home_team
  32. if(feed == "away") then
  33. feed_title = away_team
  34.  
  35. end
  36. local d = node:add_subnode({title = feed_title})
  37. local ipad = ass.children_map['ipad_url'][1].children[1]
  38. for _, q in ipairs(quality) do
  39. local url = string.gsub(ipad, "ipad", q)
  40. d:add_subitem({path = url , options = {":http-user-agent=AppleCoreMedia%2f1.0.0.8F455%20(AppleTV%3b%20U%3b%20CPU%20OS%204_3%20like%??20Mac%20OS%20X%3b%20de_de"} , title = away_team .. " @ " .. home_team .. '(' .. q .. ' kbps)'})
  41. end
  42.  
  43. end
  44. end
  45. end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement