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.

 

#!/bin/bash
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."
exit
fi
for file in $2/*
do
 omxplayer -o $1 $file
done

Example:
[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 http://www.experimental-engineering.co.uk/wp-content/plugins/download-monitor/download.php?id=1 && chmod +x /usr/bin/playseries