Posted on 4 Comments

OMXPlayer Series Play

This is a little script to make OMXPlayer on the Raspberry Pi cycle through every file in a specified folder, useful for playing sequential movies or series of episodes.


if [ x"$1" = x"help" -o x"$1" = x"--help" -o x"$1" = x"-help" ];then
 echo "Usage: omxseries  [folder path]"
 echo "Audio Mode can be either 'hdmi' or 'local'."
 echo "Folder Path is the full path to the video files on your system."
 echo "This script will attempt to play every file in the target folder, with any file extension,"
 echo "so ensure that only valid video files are present in the target folder to avoid errors."
for file in $2/*
 omxplayer -o $1 $file

[root@raspbian ~]# omxseries hdmi /media/stuff/videos
would play everything in /media/stuff/videos and send the audio over the HDMI port.

Download the script to your Pi with this code:

wget -O /usr/bin/playseries && chmod +x /usr/bin/playseries