Hi, I'm writing a script that generates a playlist in text and then reads the file line by line and plays each song listed with a different executable depending upon the file extension of the song in question. If the song ends in .mp3, it attempts to play it through mpg123. If the song ends in .vgz or .vgm, we want to play it through VGMPlay. The problem arises whenever a vgz or vgm with a space in the file name is played from that playlist file. Despite having the filename passed along to VGMPlay quoted, VGMPlay errors out on the file. If I call VGMPlay on the command line with the same song, it works fine. mpg123 does not display this sort of issue.
The purpose of all this is to have a script that plays music in the background for a Raspberry Pi.
Example playlist, test.m3u:
/home/pigaming/bgm/03 The King of Speed.vgz
/home/pigaming/bgm/3 yes.mp3
Script for playing:
while read p; do
if [[ "$p" == *.mp3 ]]
then
mpg123 "$p"
else
/opt/retropie/ports/vgmplay/vgmplay "$p"
fi
done <test.m3u
Hi, I'm writing a script that generates a playlist in text and then reads the file line by line and plays each song listed with a different executable depending upon the file extension of the song in question. If the song ends in .mp3, it attempts to play it through mpg123. If the song ends in .vgz or .vgm, we want to play it through VGMPlay. The problem arises whenever a vgz or vgm with a space in the file name is played from that playlist file. Despite having the filename passed along to VGMPlay quoted, VGMPlay errors out on the file. If I call VGMPlay on the command line with the same song, it works fine. mpg123 does not display this sort of issue.
The purpose of all this is to have a script that plays music in the background for a Raspberry Pi.
Example playlist, test.m3u: /home/pigaming/bgm/03 The King of Speed.vgz /home/pigaming/bgm/3 yes.mp3
Script for playing: while read p; do if [[ "$p" == *.mp3 ]] then mpg123 "$p" else /opt/retropie/ports/vgmplay/vgmplay "$p" fi done <test.m3u