Rhythmblock/neodj.lua

43 lines
802 B
Lua
Raw Normal View History

accentColor = colors.gray
buttonColor = colors.lightGray
backgroundColor = colors.black
2021-05-06 04:49:37 +00:00
peripherals = peripheral.getNames()
if #peripherals < 0 then
print "No drive"
2021-05-06 04:49:37 +00:00
else
2021-05-06 04:51:37 +00:00
driveCount = 0
2021-05-06 04:49:37 +00:00
for n = 1, #peripherals do
local driveCheck = peripherals[n]
if peripheral.getType(driveCheck) == "drive" then
drive = driveCheck
driveCount = driveCount + 1
end
end
2021-05-06 04:50:35 +00:00
if driveCount > 1 then
2021-05-06 04:49:37 +00:00
print("Too many disk drives. Please remove some and try again")
exit()
end
end
2021-05-06 03:55:24 +00:00
2021-05-06 04:20:44 +00:00
function playDisc()
2021-05-06 04:15:32 +00:00
disk.playAudio(drive)
print(disk.getAudioTitle(drive))
end
2021-05-06 03:55:24 +00:00
2021-05-06 04:20:44 +00:00
function ejectDisc()
disk.eject()
2021-05-06 04:20:44 +00:00
end
2021-05-06 04:21:31 +00:00
function stopDisc()
disk.stopAudio()
2021-05-06 04:20:44 +00:00
end
if disk.isPresent(drive) and disk.hasAudio(drive) then
2021-05-06 04:20:44 +00:00
playDisc(drive)
elseif disk.isPresent(drive) then
2021-05-06 03:55:24 +00:00
print "Not a music disc"
else
print "No disc"
end
2021-05-06 03:55:24 +00:00