Advertisement
TheRockettek

Untitled

May 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local songList = "LajAJwja"
  2. local condense = "W3jHDPSX"
  3. local songPlayer = "695qWt0q"
  4. print("Downloading dependency...")
  5. shell.run("rm cond")
  6. shell.run("rm player")
  7. shell.run("pastebin get " .. condense .. " cond")
  8. shell.run("pastebin get " .. songPlayer .. " player")
  9. print("Updating list...")
  10. shell.run("pastebin get " .. songList .. " .songlist")
  11. print("Starting up...")
  12. size = {term.getSize()}
  13. nb = peripheral.find("Music") or peripheral.find("minecraft:noteblock")
  14. if not nb then
  15. if peripheral.find("neuralInterface") then
  16. if peripheral.find("neuralInterface").playNote then
  17. nb = peripheral.find("neuralInterface")
  18. end
  19. end
  20. end
  21. local function centerText(text,yOffset)
  22. yOffset = yOffset or 0
  23. local x,y = term.getSize() local x2,y2 = term.getCursorPos()
  24. term.setCursorPos(math.round((x / 2) - (text:len() / 2)), y2+yOffset)
  25. write(text)
  26. end
  27. if ( not nb ) or ( not nb.playNote ) then
  28. term.setBackgroundColour(colours.lightGrey)
  29. term.setTextColour(colours.gray)
  30. centerText("Couldn't locate noteblock")
  31. centerText("Playing may not work!",1)
  32. sleep(4)
  33. end
  34.  
  35.  
  36. clr = {}
  37. for i,k in pairs(colours) do
  38. if type(k) == "number" and i ~= "black" then
  39. table.insert(clr,k)
  40. end
  41. end
  42.  
  43. term.clear()
  44. songs = {}
  45. f = fs.open(".songlist","r")
  46. while true do
  47. line = f.readLine()
  48. if not line then break else table.insert(songs,line) end
  49. end
  50. while true do
  51. songname = songs[math.random(1,#songs)]
  52. print("Downloading " .. songname)
  53. shell.run("wget http://hackery.site/computercraft/lua-songs/" .. songname:gsub(" ","%%20") .. ".lua temp")
  54. shell.run("cond temp .temp")
  55. shell.run("rm temp")
  56. shell.run("player .temp \"" .. songname .. "\"")
  57. shell.run("rm .temp")
  58. term.clear()
  59. term.setCursorPos(1,1)
  60. sleep(1)
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement