From 975f3d9aacea934f05d8e08ee3e79b984ac9cac3 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 1 May 2022 17:11:51 -0400 Subject: [PATCH] only update every 30, mark as present when playing --- main.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.rb b/main.rb index cca2803..c9fa5e0 100644 --- a/main.rb +++ b/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")