flooferland

cc-media

Aug 19th, 2024 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.31 KB | None | 0 0
  1. -- Launcher and installer for the media software
  2. -- Has to be regularly updated over on https://pastebin.com/UQ025xVy
  3.  
  4. -- Paths
  5. local paths = {}
  6. paths.folders = {}
  7. paths.folders.install = "/media/"
  8. paths.folders.libs = fs.combine(paths.folders.install, "lib/")
  9. paths.folders.localSongs = fs.combine(paths.folders.install, "songs/")
  10. paths.drive = "hdd"
  11. paths.program = fs.combine(paths.folders.install, "program.lua")
  12. paths.library = fs.combine(paths.folders.install, "library.lua")
  13. paths.jsonlib = fs.combine(paths.folders.install, "lib", "json.lua")
  14. paths.youcubelib = fs.combine(paths.folders.install, "lib", "youcubeapi.lua")
  15. paths.stringpacklib = fs.combine(paths.folders.install, "lib", "string_pack.lua")
  16. paths.combine = function(...)
  17.     local result = ""
  18.     for i, a in ipairs(arg) do
  19.         result = result .. "/" .. a
  20.     end
  21.     return result
  22. end
  23.  
  24. -- Utility
  25. local function install(path, link)
  26.     local req = http.get(link)
  27.     local f = fs.open(path, 'w')
  28.     f.write(req.readAll())
  29.     f.close()
  30.     req.close()
  31. end
  32.  
  33. -- Making the folders
  34. for i, path in pairs(paths.folders) do
  35.     if not fs.isDir(path) then
  36.         print("Making '"..path.."' folder..")
  37.         fs.makeDir(path)
  38.     end
  39. end
  40.  
  41. -- Extra files
  42. local f = fs.open(fs.combine(paths.folders.localSongs, "PUT FILES HERE.txt"), 'w')
  43. f.close()
  44.  
  45. -- Install libraries
  46. if not (fs.exists(".devenv") or fs.exists(paths.combine(paths.folders.install, ".devenv"))) then
  47.     install(paths.program, "https://raw.githubusercontent.com/FlooferLand/cc-media/main/media/program.lua")
  48.     install(paths.library, "https://raw.githubusercontent.com/FlooferLand/cc-media/main/media/library.lua")
  49. else
  50.     print("Developer environment detected")
  51. end
  52. install(paths.jsonlib, "https://gist.githubusercontent.com/tylerneylon/59f4bcf316be525b30ab/raw/7f69cc2cea38bf68298ed3dbfc39d197d53c80de/json.lua")
  53. install(paths.youcubelib, "https://raw.githubusercontent.com/FlooferLand/youcube-client/main/src/lib/youcubeapi.lua")
  54. install(paths.stringpacklib, "https://raw.githubusercontent.com/FlooferLand/youcube-client/main/src/lib/string_pack.lua")
  55.  
  56. -- Running the program
  57. if not (fs.exists(".owner") or fs.exists(paths.combine(paths.folders.install, ".owner"))) then
  58.     print("Running cc-media (by FlooferLand)")
  59.     sleep(0.8)
  60. end
  61. shell.run(paths.program)
  62.  
  63.  
Advertisement
Add Comment
Please, Sign In to add comment