126 lines
3.6 KiB
Markdown
126 lines
3.6 KiB
Markdown
# Slideshow
|
|
|
|
The below commands will setup ```fim``` as a slideshow on your display.
|
|
|
|
## Important Notes
|
|
|
|
* ```fim``` will crash if there are no photos for it to use as a slideshow
|
|
* You will likely want to tweak the ```fim``` command invocation below. These are great settings as a starting point but you'll probably want to make adjustments for your use case.
|
|
* This setup uses ```incron``` to restart ```fim``` when photos are deleted from the pictures folder. Without this piece ```fim``` will crash if a picture is removed from the pictures directory prior to ```fim``` rescaning the pictures directory.
|
|
|
|
## Setup
|
|
|
|
``` sh
|
|
|
|
# Setup UI binary
|
|
DL_URL=$(curl https://git.kemonine.info/api/v1/repos/PiFrame/piframe-go/releases | jq -r '.[0].assets[] | select(.name == "ui") | .browser_download_url')
|
|
wget $DL_URL -O /usr/local/bin/pf-ui
|
|
chmod a+x /usr/local/bin/pf-ui
|
|
|
|
# Setup systemd service for UI
|
|
mkdir /etc/systemd/system/getty@tty1.service.d/
|
|
cat > /etc/systemd/system/getty@tty1.service.d/override.conf <<EOF
|
|
[Service]
|
|
ExecStart=
|
|
ExecStart=-/usr/local/bin/pf-ui
|
|
StandardInput=tty
|
|
StandardOutput=tty
|
|
EOF
|
|
|
|
# Add fim user and setup fim
|
|
useradd -m -G video -s /usr/sbin/nologin fim
|
|
apt install acl
|
|
setfacl -m "u:fim:rwX" /tank/pictures
|
|
setfacl -dm "u:fim:rwX" /tank/pictures
|
|
apt install fim imagemagick ttf-dejavu
|
|
cat > /usr/local/etc/fimrc <<EOF
|
|
# Ensure simages are auto-centered on the screen
|
|
_want_autocenter=1;
|
|
# Reduce the amount of ram used by dialing back the image cache
|
|
_max_cached_images=1;
|
|
# Rotate screen if the display used (CONFU 5.5 in particular) isn't rotated proper
|
|
#_orientation=2;
|
|
# Turn on/off status bar and similar
|
|
_display_busy=0;
|
|
_display_console=0;
|
|
_display_status=0;
|
|
_display_status_bar=0;
|
|
_display_status_fmt=0;
|
|
EOF
|
|
cat > /etc/default/fim_albums <<EOF
|
|
/tank/pictures
|
|
EOF
|
|
cat > /usr/local/bin/pf-fim.sh <<EOF
|
|
#!/bin/bash
|
|
chvt 1
|
|
tput civis
|
|
exec </dev/tty1 >/dev/tty1 2>/dev/tty1
|
|
#echo 2 > /sys/class/graphics/fbcon/rotate_all
|
|
ALBUM_PATH=\`cat /etc/default/fim_albums\`
|
|
/usr/bin/fim --verbose --no-commandline --no-history \
|
|
--device /dev/fb0 --vt 1 \
|
|
--execute-commands-early "clear" --final-commands "clear" \
|
|
--execute-commands 'while(1){display;sleep "300";next;}' \
|
|
--autozoom --random \
|
|
--cd-and-readdir --recursive \
|
|
"\$ALBUM_PATH"
|
|
EOF
|
|
chmod a+x /usr/local/bin/pf-fim.sh
|
|
cat > /etc/systemd/system/pf-ui.service <<EOF
|
|
[Unit]
|
|
Description=PiFrame UI
|
|
After=getty.target
|
|
|
|
[Service]
|
|
User=fim
|
|
ExecStart=/usr/local/bin/pf-ui
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
cat > /usr/local/bin/no-cursor-tty1.sh <<EOF
|
|
#!/bin/bash
|
|
/usr/bin/tput -T screen civis > /dev/tty1
|
|
EOF
|
|
chmod a+x /usr/local/bin/no-cursor-tty1.sh
|
|
cat > /etc/systemd/system/no-cursor-tty1.service <<EOF
|
|
[Unit]
|
|
Description=Disable tty1 cursor
|
|
After=getty.target
|
|
|
|
[Service]
|
|
User=root
|
|
ExecStart=/usr/local/bin/no-cursor-tty1.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
DL_URL=$(curl https://git.kemonine.info/api/v1/repos/PiFrame/piframe-go/releases | jq -r '.[0].assets[] | select(.name == "inotify") | .browser_download_url')
|
|
wget $DL_URL -O /usr/local/bin/pf-inotify
|
|
chmod a+x /usr/local/bin/pf-inotify
|
|
cat > /etc/systemd/system/inotify-pictures.service <<EOF
|
|
[Unit]
|
|
Description=Watch for picture folder changes and restart slideshow
|
|
After=fim.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
ExecStart=/usr/local/bin/pf-inotify
|
|
TimeoutSec=15
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable --now no-cursor-tty1
|
|
systemctl enable getty@tty1.service
|
|
systemctl restart getty@tty1.service
|
|
systemctl enable --now inotify-pictures
|
|
|
|
```
|