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)"
|
||||
exit
|
||||
end
|
||||
if mpc.running
|
||||
if mpc.running?
|
||||
puts "starting mpd if not already running"
|
||||
`systemctl start mpd` unless `ps aux | grep mpd` != ""
|
||||
mpc.reset
|
||||
@ -103,12 +103,12 @@ end
|
||||
puts("logging into discord")
|
||||
bot.run(true)
|
||||
puts("starting main loop")
|
||||
timer = 5
|
||||
timer = 30
|
||||
loop do
|
||||
sleep timer
|
||||
if !mpc.playing?
|
||||
bot.online
|
||||
current = mpc.nowplaying
|
||||
puts("listening to #{current}")
|
||||
status = bot.listening=current
|
||||
if status != current
|
||||
puts("tried to update listening status but got #{status} back")
|
||||
|
Loading…
Reference in New Issue
Block a user