我找不到在 shell 脚本中使用 omxplayer 以随机“随机播放”顺序播放文件夹中的视频的方法。我希望它循环播放“播放列表”,但到目前为止,我只能找到一种方法来按字母顺序循环播放所有文件夹。我使用下面的代码版本进行循环。
#!/bin/sh
# get rid of the curso so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/home/pi/Videos"
# you can normally leave this alone
SERVICE="omxplayer"
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
sleep 1;
else
for entry in $VIDEOPATH/*
do
clear
omxplayer $entry > /dev/null
done
fi
done