Work getting this deployable on raspbian buster (latest makes omxplayer a nightmare to install).

This commit is contained in:
Matt McWilliams 2024-03-27 21:06:24 -04:00
parent f909a90e33
commit 830e2b3dd4
4 changed files with 56 additions and 3 deletions

View File

@ -28,6 +28,10 @@ SetupHistory () {
echo "${HISTORY_SETUP}" | sqlite3 "${HISTORY}"
}
WipeHistory () {
rm -f "${HISTORY}"
}
SetupPlayback () {
echo "${PLAYBACK_SETUP}" | sqlite3 "${PLAYBACK}"
}
@ -36,6 +40,15 @@ WipePlayback () {
rm -f "${PLAYBACK}"
}
GetRandom () {
QUERY="SELECT video FROM playback ORDER BY RANDOM() LIMIT 1;"
sqlite3 "${HISTORY}" "${QUERY}"
}
UpdateHistory () {
QUERY="INSERT INTO"
}
PDB () {
sqlite3 "${PLAYBACK}" "${1}"
}
@ -43,3 +56,4 @@ PDB () {
HDB () {
sqlite3 "${HISTORY}" "${1}"
}

21
nginx-rtmp.conf Normal file
View File

@ -0,0 +1,21 @@
rtmp {
server {
listen 1935;
application live {
# Enable livestreaming
live on;
# Disable recording
record off;
# Allow only this machine to play back the stream
allow play 127.0.0.1;
deny play all;
# Start omxplayer and play the stream out over HDMI
#exec /home/pi/stream.sh $name;
}
}
}

14
setup_raspi.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
################################################
#
# Works with 2020-02-13-raspbian-buster-lite.zip
#
################################################
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y git curl omxplayer nginx libnginx-mod-rtmp
sudo apt autoremove
sudo cat ./nginx-rtmp.conf >> /etc/nginx/nginx.conf

8
tv.sh
View File

@ -26,7 +26,6 @@ AllFiles () {
echo "${fileList}"
}
SetupHistory
WipePlayback
SetupPlayback
@ -37,11 +36,16 @@ while true; do
files=$(AllFiles)
fileCount=$(cat "${files}" | wc -l)
playbackCount=$(PDB "SELECT COUNT(*) FROM playback")
if [ ${fileCount} -eq 0 ]; then
echo "No files to play :("
break
fi
if [ ${playbackCount} -eq 0 ]; then
WipeHistory
SetupHistory
continue
fi
break
done