-
Notifications
You must be signed in to change notification settings - Fork 0
/
LimewireV2.1.lua
58 lines (58 loc) · 1.48 KB
/
LimewireV2.1.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Repo = "https://github.com/AstoriaFloyd/LimewireCC/raw/master/"
Filename = "Default"
Extension = ".dfpwm"
Download = Repo..Filename..Extension
tape = peripheral.find("tape_drive")
term.setBackgroundColor(colors.lime)
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.white)
print("Limewire Version 2.1")
if tape == nil then
print("No Drive")
else
print("Which Operation would you like to use?")
print("1:Download a file(Case Sensitive)")
print("2:Download list of available files")
print("3:List available files")
print("4:Rewind tape")
print("Enter:Exit Limewire")
local op = read()
if op == "1" then
print("Please enter filename you would like to download")
write("File:")
Filename = read()
FName = Filename..Extension
url = Repo..FName
local response = http.get(url, nil, true) -- THIS IS IMPORTANT
print("Downloading")
tape.seek(-tape.getPosition()) --Rewind to start
tape.write(response.readAll())
response.close()
tape.seek(-tape.getPosition())
tape.setLabel(Filename)
print("Music Written")
sleep(3)
shell.run("Limewire")
end
if op == "2" then
shell.run("rm", "OP.txt")
shell.run("wget", Repo.."OP.txt")
print("List Downloaded")
sleep(3)
shell.run("Limewire")
end
if op == "3" then
local list = fs.open("OP.txt", "r")
textutils.pagedPrint(list.readAll())
sleep(3)
shell.run("Limewire")
end
if op == "4" then
tape.seek(-tape.getPosition())
shell.run("Limewire")
end
term.setBackgroundColor(colors.black)
term.setCursorPos(1,1)
term.clear()
end