A Python Script witch autostart with the Pi and play videos in an endless loop. The playlist depends on the files in the selected directory.
Use the Raspbian Image, I recommended a lite version.
Download @ https://www.raspberrypi.org/downloads/raspbian/
sudo dd if=path_of_your_image.img of=/dev/sdX bs=1M && sync
ssh pi@raspberrypi
Default User: pi
Default Password: raspberry
At first expand you SD Card disk size.
Officially Documentation about raspi-confi
: https://www.raspberrypi.org/documentation/configuration/raspi-config.md
sudo raspi-config
Don't forget to reboot your Pi
sudo reboot
passwd
sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove
This will update your Pi daily with important security updates.
sudo apt-get install unattended-upgrades
sudo echo 'APT::Periodic::Update-Package-Lists "1";' > /etc/apt/apt.conf.d/10periodic
sudo echo 'APT::Periodic::Update-Package-Lists "1";' >> /etc/apt/apt.conf.d/10periodic
sudo echo 'APT::Periodic::Download-Upgradeable-Packages "1";' >> /etc/apt/apt.conf.d/10periodic
sudo echo 'APT::Periodic::AutocleanInterval "7";' >> /etc/apt/apt.conf.d/10periodic
sudo echo 'APT::Periodic::Unattended-Upgrade "1";' >> /etc/apt/apt.conf.d/10periodic
Resilio Sync is an decentralized private cloud Software. To easy update the video Playlist from your computer or smartphone.
wget https://download-cdn.resilio.com/stable/linux-arm/resilio-sync_arm.tar.gz
tar xfvz resilio-sync_arm.tar.gz
sudo mv rslsync /usr/bin/
rm LICENSE.TXT
rm resilio-sync_arm.tar.gz
Create a service for reslio sync
sudo nano /etc/init.d/rslsync
And add the following content.
#!/bin/sh
### BEGIN INIT INFO
# Provides: /usr/bin/rslsync
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start reslio sync as a damon
# Description: start reslio sync as a damon
### END INIT INFO
# Actions
case "$1" in
start)
# START
/bin/su - pi -c "/usr/bin/rslsync --webui.listen 0.0.0.0:8888"
;;
stop)
# STOP
pkill rslsync
;;
restart)
# RESTART
pkill rslsync
/bin/su - pi -c "/usr/bin/rslsync --webui.listen 0.0.0.0:8888"
;;
esac
exit 0
- Make the service executable
- Add start stop service
sudo chmod +x /etc/init.d/rslsync
sudo update-rc.d rslsync defaults
sudo reboot
To start, stop & restart resilio use:
sudo service rslsync start
sudo service rslsync stop
sudo service rslsync restart
To check if resilio sync is working fine, use ps -ef | grep rslsync
root 371 1 3 14:52 ? 00:00:01 /usr/bin/rslsync --webui.listen 0.0.0.0:8888
pi 666 636 0 14:53 pts/0 00:00:00 grep --color=auto rslsync
sudo apt-get install python-dbus
sudo pip install --upgrade --force git+git://github.com/linuxluigi/RaspberryPi_video_loop.git
Create the file /etc/RaspberryPi_video_loop.conf
with your directory path into it.
Important, the dir path have to end with a /
!!
sudo sh -c "echo '[Dir]' > /etc/RaspberryPi_video_loop.conf"
sudo sh -c "echo 'dir = /home/pi/Videos/' >> /etc/RaspberryPi_video_loop.conf"
Create a service for RaspberryPi_video_loop
sudo apt-get install xterm
sudo nano /etc/init.d/video_loop
And add the following content.
python /usr/local/lib/python2.7/dist-packages/raspberrypi_video_loop
#!/bin/sh
### BEGIN INIT INFO
# Provides: /usr/bin/omxplayer
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start video_loop
# Description: start video_loop
### END INIT INFO
# Actions
case "$1" in
start)
# START
/bin/su - pi -c "/usr/bin/video_loop"
;;
stop)
# STOP
pkill video_loop
;;
restart)
# RESTART
pkill video_loopa
/bin/su - pi -c "/usr/bin/video_loop"
;;
esac
exit 0
edit /etc/kbd/config and set BLANK_TIME=0 and POWERDOWN_TIME=0 then run /etc/init.d/kbd restart.
- Make the service executable
- Add start stop service
sudo chmod +x /etc/init.d/video_loop
sudo update-rc.d video_loop defaults
sudo reboot
To start, stop & restart resilio use:
sudo service video_loop start
sudo service video_loop stop
sudo service video_loop restart
Add before exit 0
the start script /bin/sleep 15 && /usr/local/lib/python2.7/dist-packages/raspberrypi_video_loop &
To test if the script is working fine reboot your pi sudo reboot
and use
ps -ef | grep python
witch will print something like:
pi@raspberrypi ps -ef | grep python
root 2055 1 10 13:47 ? 00:00:01 python /usr/local/lib/python2.7/dist-packages/raspberrypi_video_loop