forked from schollz/broadcast
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbroadcast.lua
57 lines (51 loc) · 1.5 KB
/
broadcast.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
--- Dumb broadcast to icecast server
-- @oootini
function init()
local toinstall=""
local s=util.os_capture("which icecast2")
if s=="" then
print("installing icecast2")
toinstall=toinstall.."icecast2 "
end
local s=util.os_capture("which ffmpeg")
if s=="" then
print("installing ffmpeg")
toinstall=toinstall.."ffmpeg "
end
local s=util.os_capture("which darkice")
if s=="" then
print("installing darkice")
toinstall=toinstall.."darkice "
end
if toinstall~="" then
local cmd="sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq "..toinstall
print('running '..cmd)
os.execute("sudo apt-get update")
os.execute(cmd)
end
-- load pset
params:read(1)
-- Clean up the old
os.execute("pkill -f broadcast0")
os.execute("pkill -f broadcast2")
os.execute("pkill -f radio.mp3")
os.execute("pkill -f broadcast1")
os.execute("pkill -9 icecast2")
os.execute("pkill -9 darkice")
-- Enable the new
os.execute("chmod +x /home/we/dust/code/broadcast/broadcast0.sh")
os.execute("chmod +x /home/we/dust/code/broadcast/broadcast1.sh")
os.execute("chmod +x /home/we/dust/code/broadcast/broadcast2.sh")
-- Broadcast!
os.execute("bash -c 'set -a && source /home/we/dust/code/broadcast/icecast.env && nohup /home/we/dust/code/broadcast/broadcast0.sh &'")
-- Say something
redraw()
end
function redraw()
screen.clear()
screen.move(10,10)
screen.text("Broadcasting live!")
screen.move(10,30)
screen.text("Eist x Plugd x Brian")
screen.update()
end