diff --git a/README.md b/README.md index 6e5b244..0f71e1e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,32 @@ # PiVideo +## Overview + This is a collection of scripts which run a video in a loop until a Button connected to GPIO is Pressed. Then another video is played once. -For installation download and run setup.sh +## Installation +For installation download and run setup.sh. This will install the nesecary dependencys, create the needed folder structure and download the Script. +It will also create a SystemD service to automaticly start the program when the Pi is booted. ```bash wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/setup.sh" +chmod 755 setup.sh ./setup.sh ``` +## Configuration +Since it is a realativly simple Python script you can modify as needed. +The videos which are played are in the videos folder, as the nameing of the files suggests the loop.mp4 is played on loop and the trigger.mp4 is played once when the GPIO button has been pressed. +You can replace the files as needed with your own files. The files included right now are just for demonstration. + +- PiVideo/ + |- videos/ + | |- loop.mp4 + | |- trigger.mp4 + |- video.py + |- start.sh + |- stop.sh + |- reload.sh + +The button to trigger the video switch is by default conected to GPIO 17 and GND, you can change this in the Scipt itself if needed. \ No newline at end of file diff --git a/reload.sh b/reload.sh index e3c0237..e428831 100755 --- a/reload.sh +++ b/reload.sh @@ -1,7 +1,13 @@ #! /bin/bash +## A simple whitch stops the current service and Starts it again +## used to run the current version of the script after modification + +# Definition of colors for the echo outputs GREEN='\033[0;32m' NOCOLOR='\033[0m' + +# Servicename which this script affects SERVICE_NAME="pivideo.service" echo -e "${GREEN}======== Stoppe Dienst =========${NOCOLOR}" diff --git a/start.sh b/start.sh index 2c9783e..e83bd41 100755 --- a/start.sh +++ b/start.sh @@ -1,14 +1,19 @@ #! /bin/bash +## A simple script which starts the playing of the Video and enables the SystemD service + +# Definition of colors for the echo outputs GREEN='\033[0;32m' NOCOLOR='\033[0m' + +# Servicename which this script affects SERVICE_NAME="pivideo.service" -echo -e "${GREEN}======== Starte Dienst =========${NOCOLOR}" +echo -e "${GREEN}======== STARTING SERVICE =========${NOCOLOR}" sudo systemctl start $SERVICE_NAME -echo -e "${GREEN}======== Starte Autostart des Diensts =========${NOCOLOR}" +echo -e "${GREEN}======== ENABELING SERVICE =========${NOCOLOR}" sudo systemctl enable $SERVICE_NAME exit 0 \ No newline at end of file diff --git a/stop.sh b/stop.sh index ed81c70..1680042 100755 --- a/stop.sh +++ b/stop.sh @@ -1,14 +1,20 @@ #! /bin/bash +## A simple script which stops the playing of the Video and disables the SystemD service + +# Definition of colors for the echo outputs GREEN='\033[0;32m' NOCOLOR='\033[0m' + +# Servicename which this script affects SERVICE_NAME="pivideo.service" -echo -e "${GREEN}======== Stoppe Dienst =========${NOCOLOR}" + +echo -e "${GREEN}======== STOPING SERVICE =========${NOCOLOR}" sudo systemctl stop $SERVICE_NAME -echo -e "${GREEN}======== Stoppe Autostart des Diensts =========${NOCOLOR}" +echo -e "${GREEN}======== DISABELING SERVICE =========${NOCOLOR}" sudo systemctl disable $SERVICE_NAME exit 0 \ No newline at end of file