3.8 KiB
3.8 KiB
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 restartfim
when photos are deleted from the pictures folder. Without this piecefim
will crash if a picture is removed from the pictures directory prior tofim
rescaning the pictures directory.
Setup
# 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 wrapper script for pf-ui so no chracters are echo'd to the tty
cat > /usr/local/bin/pf-ui.sh <<EOF
#!/bin/bash
/usr/bin/stty -echo
/usr/local/bin/pf-ui
EOF
chmod a+x /usr/local/bin/pf-ui.sh
# Setup systemd service for UI
cat > /etc/systemd/system/pf-ui.service <<EOF
[Unit]
Description=PiFrame UI
After=getty.target
[Service]
User=root
ExecStart=/usr/local/bin/pf-ui.sh
Restart=always
TTYPath=/dev/tty1
StandardInput=tty
StandardOutput=tty
[Install]
WantedBy=multi-user.target
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
# Setup slideshow script stuff
cat > /etc/default/fim_albums <<EOF
/tank/pictures
EOF
cat > /usr/local/bin/pf-fim.sh <<EOF
#!/bin/bash
/usr/bin/chvt 1
/usr/bin/tput -T screen civis > /dev/tty1
#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 --etc-fimrc /usr/local/etc/fimrc \
--device /dev/fb0 --vt 1 \
--execute-commands-early "clear" --final-commands "clear" \
--autozoom --random \
--cd-and-readdir --recursive \
"\$ALBUM_PATH"
EOF
chmod a+x /usr/local/bin/pf-fim.sh
# Setup console config stuff
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
# Setup watcher for filesystem events
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 disable getty@tty1.service
systemctl stop getty@tty1.service
systemctl enable --now pf-ui
systemctl enable --now inotify-pictures