Created
August 21, 2019 09:19
-
-
Save jonasbits/8a5f95538370760fadbe74afaa3b3bd7 to your computer and use it in GitHub Desktop.
konstpaj umeahackerspace autoplay video on rpi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Umeå Hackerspace konstpaj self-explanatory configuration file | |
term=1 | |
xres=1920 | |
yres=1080 | |
# auto=0, analogue=1, hdmi=2 | |
aout=0 | |
vol=0 | |
background="black.ppm" | |
videofolder="videos" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@reboot /usr/local/sbin/konstpaj.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install omxplayer fbset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp /boot/konstpaj/konstpaj.sh /usr/local/sbin/ | |
chmod 755 /usr/local/sbin/konstpaj.sh | |
mkdir -p /mnt/konstusb/videos/ | |
cp /boot/konstpaj/black.ppm /mnt/konstusb/ | |
#add crontab and systemd-service install here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# do whatever the fuck you want license /Umeå Hackerspace | |
MOUNTDRIVE="/dev/sda1" | |
KONSTROOT="/mnt/konstusb" | |
KONSTCONFIG="${KONSTROOT}/config" | |
DEFAULTBG="black.ppm" | |
mkdir -p "${KONSTROOT}" | |
mount "${MOUNTDRIVE}" "${KONSTROOT}" | |
cd "${KONSTROOT}" || (echo could not cd into "${KONSTROOT}" | tee /var/log/konstpaj.log && exit 1) | |
if [ ! -f "${DEFAULTBG}" ]; then | |
# create background | |
cat <<EOF > "${DEFAULTBG}" | |
P1 | |
1 1 | |
1 | |
EOF | |
# end of background | |
fi | |
if [ ! -f "${KONSTCONFIG}" ]; then | |
#create config file | |
cat <<EOF > "${KONSTCONFIG}" | |
#Umeå Hackerspace konstpaj self-explanatory configuration file | |
term=1 | |
xres=1920 | |
yres=1080 | |
# auto=0, analogue=1, hdmi=2 | |
aout=0 | |
vol=0 | |
background="${DEFAULTBG}" | |
videofolder="videos" | |
EOF | |
# end of config | |
fi | |
if [ "x" = "x$aout" ]; then | |
aout=0 | |
fi | |
. /mnt/konstusb/config | |
if [ ! -d "${videofolder}" ]; then | |
mkdir "${videofolder}" | |
fi | |
fbset -xres "${xres}" -yres "${yres}" | |
(sleep 2; amixer cset numid=3 "$aout")& | |
(sleep 5; fbi -T "${term}" -noverbose "${background}")& | |
#(cd "${KONSTROOT}" && . "${KONSTCONFIG}" && while true; do sleep 1; processes=$(pgrep fbi|wc -l) ; if [ $processes -eq 0 ]; then fbi -T "${term}" -noverbose "${background}"; fi ; done)& | |
omxplayer --loop --vol "$vol" "${videofolder}"/*.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Mount USB with video for konstpaj | |
[Mount] | |
What=/dev/sda1 | |
Where=/mnt/konstusb | |
Type=vfat | |
Options=defaults | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment