-
Notifications
You must be signed in to change notification settings - Fork 3
/
startup.lua
64 lines (49 loc) · 1.7 KB
/
startup.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
59
60
61
62
63
64
term.clear()
settings.define("media_center.volume", {
description = "The volume to play songs at.",
default = 1.0,
type = "number"
})
print("Welcome to the media center!")
print("")
if peripheral.find("drive") == nil then
print("WARN - No valid disk drive was found. You will have to save files to the device using `savetodevice`, or, connect a disk drive.")
else
print("To play songs, just insert a disk into the connected disk drive, and run the 'play' command.")
end
print("")
if peripheral.find("speaker") == nil then
print("ERR - No valid speaker was found!")
else
local speaker = peripheral.find("speaker")
local instr = "bell"
speaker.playNote(instr, 3, 4)
sleep(0.3)
speaker.playNote(instr, 3, 8)
sleep(0.3)
speaker.playNote(instr, 3, 15)
sleep(0.3)
speaker.playNote(instr, 3, 16)
sleep(0.5)
speaker.playNote(instr, 3, 4)
sleep(0.01)
speaker.playNote(instr, 3, 8)
sleep(0.01)
speaker.playNote(instr, 3, 15)
sleep(0.01)
speaker.playNote(instr, 3, 16)
sleep(0.01)
local updateUri = "https://raw.githubusercontent.com/Metalloriff/cc-music-player/main/version.txt"
local updateResponse = http.get(updateUri)
if fs.exists("version.txt") then
local updateFile = fs.open("version.txt", "r")
if updateFile.readAll() ~= updateResponse.readAll() then
print("")
print("NOTE - There is an update available! To get the latest version, type 'download' into the console.")
end
end
end
print("")
print("To save songs, they need to be converted to the DFPWMA audio format and uploaded to a static hosting site. For more information on this, enter 'help saving'.")
if fs.exists("download.lua") then fs.delete("download.lua") end
if fs.exists("install.lua") then fs.delete("install.lua") end