From 84a903f116e99403023de753b1db980312446b8f Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sat, 11 Mar 2017 13:33:51 +0200 Subject: [PATCH] Redirected output of the player programs to /dev/null --- src/plugins/sound_playfile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/sound_playfile.py b/src/plugins/sound_playfile.py index 65d5dda9..c8216d07 100644 --- a/src/plugins/sound_playfile.py +++ b/src/plugins/sound_playfile.py @@ -12,13 +12,17 @@ except ImportError: play_cmd = {} + def _subprocess(*args): + FNULL = open(os.devnull, 'wb') + subprocess.call( + args, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True) + def connect_plugin(sound_file): global play_cmd ext = os.path.splitext(sound_file)[-1] try: - subprocess.call([play_cmd[ext], sound_file]) - return + return _subprocess(play_cmd[ext], sound_file) except (KeyError, AttributeError): pass @@ -29,7 +33,7 @@ except ImportError: programs += ['mpg123', 'mpg321', 'mpg321-mpg123'] for cmd in programs: try: - subprocess.call([cmd, sound_file]) + _subprocess(cmd, sound_file) except OSError: pass # log here! else: