Posts: 24
Threads: 11
Joined: Feb 2020
Reputation:
0
11-12-2020, 02:30 PM
(This post was last modified: 11-12-2020, 02:34 PM by avior.)
hi
when i do this " mpc,load, Mp3 " it works and load the new play list but can,t get it play and clear the old list
I tried this as well but don`t seem to work
mpc,clear,load, Mp3 ,play
mpc,clear, mpc,load,Mp3, play
any ideas
thanks
Posts: 13,436
Threads: 305
Joined: Mar 2018
Reputation:
545
Put the commands in a script file /home/pi/myscript.sh
mpc clear
mpc load Mp3
mpc play
Then specify the script file in the CMD field
/home/pi/myscript.sh
Remember to mark the script file as executable
sudo chmod +x /home/pi/myscript.sh
And put a shebang as the first line
#!/bin/bash
Posts: 13,436
Threads: 305
Joined: Mar 2018
Reputation:
545
You could have the script accept an input argument.
myscript.sh Mp3
myscript.sh Radio
In the script $1 represents the first input argument. You would use the command below instead of mpc load Mp3
mpc load $1
Button 1 CMD field = /home/pi/myscript.sh,Mp3
Button 2 CMD field = /home/pi/myscript.sh,Radio