Plays folders of videos on a loop from boot, with a controller menu, per-video on/off, play settings, a logo boot splash and a nightly YouTube sync. Tested on a Raspberry Pi 4; x86 paths are untested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.1 KiB
Bash
Executable File
54 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Installs everything on a Raspberry Pi or an x86 PC running Debian-style Linux, and
|
|
# starts the player now and at every boot. Run it as the user that will own the
|
|
# player, from anywhere. See SETUP.md first on a new machine.
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
DIR=$(pwd)
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends mpv ffmpeg python3-evdev fonts-dejavu-core \
|
|
alsa-utils curl unzip
|
|
sudo usermod -aG video,render,audio,input "$USER"
|
|
|
|
# The splash only takes orders from root; the player runs as this user.
|
|
echo "$USER ALL=(root) NOPASSWD: /usr/bin/plymouth, /usr/sbin/plymouthd" \
|
|
| sudo tee /etc/sudoers.d/enrichment-player >/dev/null
|
|
sudo chmod 440 /etc/sudoers.d/enrichment-player
|
|
sudo visudo -cf /etc/sudoers.d/enrichment-player
|
|
|
|
case "$(uname -m)" in
|
|
aarch64) YT_DLP=yt-dlp_linux_aarch64; DENO=deno-aarch64-unknown-linux-gnu.zip ;;
|
|
x86_64) YT_DLP=yt-dlp_linux; DENO=deno-x86_64-unknown-linux-gnu.zip ;;
|
|
*) echo "Unsupported machine: $(uname -m)"; exit 1 ;;
|
|
esac
|
|
|
|
# yt-dlp and deno are kept up to date by the nightly sync, so they live here
|
|
# rather than in apt, whose copies fall behind YouTube.
|
|
mkdir -p ~/.local/bin ~/enrichment_videos
|
|
[ -x ~/.local/bin/yt-dlp ] || {
|
|
curl -fsSL -o ~/.local/bin/yt-dlp \
|
|
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/$YT_DLP"
|
|
chmod +x ~/.local/bin/yt-dlp
|
|
}
|
|
[ -x ~/.local/bin/deno ] || {
|
|
curl -fsSL -o /tmp/deno.zip \
|
|
"https://github.com/denoland/deno/releases/latest/download/$DENO"
|
|
unzip -q -o /tmp/deno.zip -d ~/.local/bin
|
|
rm /tmp/deno.zip
|
|
}
|
|
|
|
boot/install_boot.sh
|
|
|
|
# The unit files name this Pi's user and folder; fit them to this machine.
|
|
for unit in enrichment-player.service enrichment-youtube-sync.service \
|
|
enrichment-youtube-sync.timer; do
|
|
sed -e "s#/home/infra/source/killer_kitties#$DIR#g" \
|
|
-e "s#/home/infra#$HOME#g" -e "s#User=infra#User=$USER#" "$unit" \
|
|
| sudo tee "/etc/systemd/system/$unit" >/dev/null
|
|
done
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable enrichment-player enrichment-youtube-sync.timer
|
|
|
|
echo "Installed. Reboot to start the player: sudo reboot"
|