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}" echo "${HISTORY_SETUP}" | sqlite3 "${HISTORY}"
} }
WipeHistory () {
rm -f "${HISTORY}"
}
SetupPlayback () { SetupPlayback () {
echo "${PLAYBACK_SETUP}" | sqlite3 "${PLAYBACK}" echo "${PLAYBACK_SETUP}" | sqlite3 "${PLAYBACK}"
} }
@ -36,10 +40,20 @@ WipePlayback () {
rm -f "${PLAYBACK}" rm -f "${PLAYBACK}"
} }
GetRandom () {
QUERY="SELECT video FROM playback ORDER BY RANDOM() LIMIT 1;"
sqlite3 "${HISTORY}" "${QUERY}"
}
UpdateHistory () {
QUERY="INSERT INTO"
}
PDB () { PDB () {
sqlite3 "${PLAYBACK}" "${1}" sqlite3 "${PLAYBACK}" "${1}"
} }
HDB () { HDB () {
sqlite3 "${HISTORY}" "${1}" 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}" echo "${fileList}"
} }
SetupHistory SetupHistory
WipePlayback WipePlayback
SetupPlayback SetupPlayback
@ -37,11 +36,16 @@ while true; do
files=$(AllFiles) files=$(AllFiles)
fileCount=$(cat "${files}" | wc -l) fileCount=$(cat "${files}" | wc -l)
playbackCount=$(PDB "SELECT COUNT(*) FROM playback") playbackCount=$(PDB "SELECT COUNT(*) FROM playback")
if [ ${fileCount} -eq 0 ]; then if [ ${fileCount} -eq 0 ]; then
echo "No files to play :(" echo "No files to play :("
break break
fi fi
if [ ${playbackCount} -eq 0 ]; then
WipeHistory
SetupHistory
continue
fi
break break
done done