1

这篇文章提供了以下 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

但即使在更改为我的首选设置之前,脚本似乎只播放文件夹中的第一个视频,它会无休止地循环播放。我已经检查了视频的权限,它们都归运行脚本的用户所有。

4

1 回答 1

1

那个剧本是错的。我已经对其进行了一些更新。看看这是否适合你

#!/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
于 2013-05-10T17:29:15.677 回答