Redirected output of the player programs to /dev/null

This commit is contained in:
Dmitri Bogomolov 2017-03-11 13:33:51 +02:00
parent 91eb75b140
commit 84a903f116
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -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: