only update every 30, mark as present when playing
This commit is contained in:
parent
6b3bc9b859
commit
975f3d9aac
6
main.rb
6
main.rb
@ -28,7 +28,7 @@ if File.exists?("/usr/bin/mpd")
|
|||||||
puts "Bailing since mpd exists but not mpc (which is needed to control mpd)"
|
puts "Bailing since mpd exists but not mpc (which is needed to control mpd)"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
if mpc.running
|
if mpc.running?
|
||||||
puts "starting mpd if not already running"
|
puts "starting mpd if not already running"
|
||||||
`systemctl start mpd` unless `ps aux | grep mpd` != ""
|
`systemctl start mpd` unless `ps aux | grep mpd` != ""
|
||||||
mpc.reset
|
mpc.reset
|
||||||
@ -103,12 +103,12 @@ end
|
|||||||
puts("logging into discord")
|
puts("logging into discord")
|
||||||
bot.run(true)
|
bot.run(true)
|
||||||
puts("starting main loop")
|
puts("starting main loop")
|
||||||
timer = 5
|
timer = 30
|
||||||
loop do
|
loop do
|
||||||
sleep timer
|
sleep timer
|
||||||
if !mpc.playing?
|
if !mpc.playing?
|
||||||
|
bot.online
|
||||||
current = mpc.nowplaying
|
current = mpc.nowplaying
|
||||||
puts("listening to #{current}")
|
|
||||||
status = bot.listening=current
|
status = bot.listening=current
|
||||||
if status != current
|
if status != current
|
||||||
puts("tried to update listening status but got #{status} back")
|
puts("tried to update listening status but got #{status} back")
|
||||||
|
Loading…
Reference in New Issue
Block a user