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
1 changed files with 7 additions and 3 deletions

View File

@ -12,13 +12,17 @@ except ImportError:
play_cmd = {}
def _subprocess(*args):
FNULL = open(os.devnull, 'wb')
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:[play_cmd[ext], sound_file])
return _subprocess(play_cmd[ext], sound_file)
except (KeyError, AttributeError):
@ -29,7 +33,7 @@ except ImportError:
programs += ['mpg123', 'mpg321', 'mpg321-mpg123']
for cmd in programs:
try:[cmd, sound_file])
_subprocess(cmd, sound_file)
except OSError:
pass # log here!