Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Variables ]]--
- local sourceFolder = "ccYouTube"
- os.loadAPI("ccYouTube/apis/loadingScreen")
- count = 4
- --local downloadsFolder = sourceFolder .. "/" .. "downloads"
- --local apisFolder = sourceFolder .. "/" .. "apis"
- -- Tables
- local t_Programs = {}
- local t_Folders = {
- { sFolderName = "downloads", sPath = sourceFolder .. "/" .. "downloads" },
- { sFolderName = "apis", sPath = sourceFolder .. "/" .. "apis" },
- }
- local t_NeededFiles = {
- apis = {
- { sFileName = "loadingScreen", sUrl = "zeG34tu6", sPath = "apis/loadingScreen"}
- }
- }
- local t_startLogo = {
- " f f eeeee e ",
- " f f e e ",
- " 9999 9999 ffff fff f f e e e eee eee",
- "9 9 f f f f f e e e e e e e",
- "9 9 ffff f f f f f e e e e e eee",
- "9 9 f f f f f e e e e e e ",
- " 9999 9999 ffff fff fff e eee eee eee",
- }
- --[[ End of Variables ]]--
- term.clear() term.setCursorPos(1, 1)
- term.setTextColour(colours.red)
- if not term.isColor() then
- print("Error; Advanced Computer Required.")
- term.setTextColour(colours.black)
- return
- elseif not http then
- print("Error; HTTP needs to be enabled.")
- term.setTextColour(colours.black)
- return
- end
- term.setTextColour(colours.black)
- function getCount()
- local count = 0
- if not fs.isDir(sourceFolder) then
- count = count + 1
- end
- for i = 1, #t_Folders do
- if not fs.exists(t_Folders[i].sPath) then
- count = count + 1
- end
- end
- for i = 1, #t_NeededFiles do
- if not fs.exists(t_NeededFiles[i].sPath) then
- count = count + 1
- if t_NeededFiles[i].sType == "api" then count = count + 1 end
- end
- end
- return count
- end
- function updateProgramList()
- t_Programs = {}
- local response = http.get("http://cc-youtube.webs.com/apps/links/")
- local sourceText = response.readAll()
- response.close()
- index = 1
- for code in sourceText:gmatch('><a href="http://pastebin.com/(.-)" target="_blank">') do
- t_Programs[index] = {}
- t_Programs[index].code = code
- index = index + 1
- end
- index = 1
- for k = 1, #t_Programs do
- for title in sourceText:gmatch('<a href="http://pastebin.com/' .. t_Programs[k].code .. '" target="_blank">(.-)</a>') do
- t_Programs[index].name = title
- end
- index = index + 1
- end
- index = 1
- for desc in sourceText:gmatch('<p class="linkDescription">(.-)</p>') do
- t_Programs[index].desc = desc
- index = index + 1
- end
- index = 1
- for pDate in sourceText:gmatch([[<div class="linkTimestamp">
- Posted (.-)
- </div>]]) do
- t_Programs[index].postDate = pDate
- index = index + 1
- end
- end
- local function initiate()
- -- Checking the required files and folders
- bar:setMessage("")
- bar:triggerUpdate( "Checking source folder... (" .. ( bar:getCurrentProgress() + 1 ) .. "/" .. count .. ")..." )
- sleep(0.5)
- if not fs.isDir(sourceFolder) then
- error("Source folder does not exist! Please re-install using the installer.")
- end
- bar:triggerUpdate( "Checking folders... (" .. ( bar:getCurrentProgress() + 1 ) .. "/" .. count .. ")..." )
- sleep(0.5)
- for i = 1, #t_Folders do
- if not fs.exists(t_Folders[i].sPath) then
- error(t_Folders[i].sPath .. " does not exist! Please re-install using the installer.")
- end
- end
- bar:triggerUpdate( "Checking files... (" .. ( bar:getCurrentProgress() + 1 ) .. "/" .. count .. ")..." )
- sleep(0.5)
- for i = 1, #t_NeededFiles do
- for k = 1, #t_NeededFiles[i] do
- if not fs.exists(t_NeededFiles[i][k].sPath) then
- error(t_NeededFiles[i][k].sPath .. " does not exist! Please re-install using the installer.")
- end
- end
- end
- -- Loading APIS
- for i = 1, #t_NeededFiles.apis do
- os.loadAPI(t_NeededFiles.apis[i].sPath)
- bar:triggerUpdate( "Loading API: " .. fs.getName(t_NeededFiles.apis[i].sPath) .. " (" .. ( bar:getCurrentProgress() + 1 ) .. "/" .. count .. ")..." )
- end
- end
- --[[ Main part of the program ]]--
- --local count = getCount()
- bar = loadingScreen.init( loadingScreen.STANDARD, t_startLogo, (3 + #t_NeededFiles.apis), 30, 14, colors.red, "Starting up...", "", "By remiX" )
- local function dobar()
- bar:run( true )
- end
- parallel.waitForAll( dobar, initiate )
- updateProgramList()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement