I am trying to control the volume of mplayer from a python program. The mplayer program starts with a bash script:
#!/bin/bash
mkfifo /home/administrator/files/mplayer-control.pipe
/usr/bin/mplayer -slave -input file=/home/administrator/files/mplayer-control.pipe /home/administrator/music/file.mp3
Then I have a GUI written in Python that needs to control the volume of the mplayer instance that is playing. I tried the following:
os.system('echo "set_property volume $musicvol" > /home/administrator/files/mplayer-control.pipe')
This works if instead of $ musicvol you need to enter a numerical value instead, but this is unfortunately useless. I need to pass a variable.
I could also solve it by calling a bash script from a Python application, but I cannot get this to work:
subprocess.call("/home/administrator/files/setvolume.sh", executable="bash", shell=True)
Julio source
share