From f8707672a093c9c95dd95c719102157583990db5 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 24 Jan 2021 22:10:01 +0700 Subject: [PATCH] fixed a small problem when mpd deamon gets lunched on first executin from i3blocks without any interaction --- mpd_controller/mpd_main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mpd_controller/mpd_main.py b/mpd_controller/mpd_main.py index 52a8818..bfe66ca 100755 --- a/mpd_controller/mpd_main.py +++ b/mpd_controller/mpd_main.py @@ -31,13 +31,14 @@ def main(): client.connect("localhost", 6600) except ConnectionRefusedError: # mpd is not connecting, try to start - output = subprocess.run(["mpd"], capture_output=True) - if output.returncode == 0: - # connect - client.connect("localhost", 6600) - else: - # that failed, all is lost - return + if mpc_command == 'toggle': + output = subprocess.run(["mpd"], capture_output=True) + if output.returncode == 0: + # connect + client.connect("localhost", 6600) + else: + # that failed, all is lost + return # follow mpc_command if mpc_command == 'toggle': mpd_playback.toggle(client, signal_id)