LibVLC is a C API for integrating VLC into other software rather than scripting a running VLC instance. The "8-20" prevent it from reopening the video loop during closed hours.Python-vlc wraps LibVLC. Line 3: Every five minutes, the script to check and re-open the video loop if needed. Line 2: Will cause the unit to reboot at 8AM. Line 1: Will cause the video loop to end at 9PM
*/5 8-20 * * * /etc/init.d/vlcontroller repair To create these tasks, run the following command.Įdit the following lines and add them to the bottom of the file: This should resolve most issues by the next day without user interaction. \- Throughout the day it will restart the video if it closes for some reason. \- The pi will reboot before the building opens, which will start the video loop. \- The unit will stop the video loop when building closes at night. To guard against issues that can creep up over time, I set the following cron tasks. In my case, this unit is going to be left on 24/7, powering a display without keyboard or mouse. If !(sudo screen -list | grep -v grep | grep videoloop > /dev/null)Įcho "Usage: /etc/init.d/videoloop " # Starts the videoloop if it is not running Sudo screen -d -m -S videoloop sh -c "$VLSCRIPT" If sudo screen -list | grep -v grep | grep videoloop > /dev/null #- There should be no need to edit anything below this line. # Short-Description: Displays videos in a directory in a loop using omxplayer
This script below calls the script created in Step 3. The following command will open the nano editor and create a file called *vlcontroller* in the */etc/init.d* directory. In this step, we will create a script to start, stop, check, and repair the video loop. \- Set Internationalisation Options (Timezone, Location, Keyboard, WiFi) \- Enable remote management (put it on a network & enable SSH) \- Change the host name (especially if you'll have more than display) \- Run **sudo apt-get update** and **sudo apt-get dist-upgrade** I will not cover it here, but I did some basic house keeping which I recommend before starting, but they are largely optional. This should work for pretty much any model Pi. The full version of Raspian will work just as well, but since I will be using the Pi only to power the display, I opted for the Lite version. I started with a fresh install of Raspbian Lite. \- Raspberry Pi running the latest version of Raspbian Lite I wanted to be able to control the video loop remotely and with scheduled tasks as the RPi would be in another building without a keyboard or mouse. This How-to covers setting up a Raspberry Pi to run all of the videos in a directory in a loop.