我有this post提供的以下bash脚本:
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/mnt/storage/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
我已将omxplayer的调用更改为全屏并输出声音:
omxplayer -r -o hdmi $entry > /dev/null
但即使在更改为我的首选设置之前,脚本似乎只播放文件夹中的第一个视频,它无休止地循环播放。我已经检查了视频的权限,并且它们都是运行脚本的用户所拥有的。
答案 0 :(得分:0)
那个剧本错了。我已经对它做了一些更新。看看它是否适合你
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/mnt/storage/videos"
# you can normally leave this alone
SERVICE="omxplayer"
for entry in $VIDEOPATH/*
do
clear
$SERVICE $entry > /dev/null
while ps ax | grep -v grep | grep $SERVICE > /dev/null
do
sleep 5;
done
done