2020-07-31 23:56:17 +00:00
# Slideshow
2020-08-03 01:05:29 +00:00
The below commands will setup ```fim``` as a slideshow on your display.
2020-07-31 23:56:17 +00:00
## Important Notes
2020-08-03 01:05:29 +00:00
* ```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.
2020-07-31 23:56:17 +00:00
## Setup
``` sh
2020-08-28 22:46:13 +00:00
# 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
2020-08-29 01:28:31 +00:00
# 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
2020-08-28 22:46:13 +00:00
# Setup systemd service for UI
2020-08-29 01:18:45 +00:00
cat > /etc/systemd/system/pf-ui.service < < EOF
[Unit]
Description=PiFrame UI
After=getty.target
2020-08-28 22:46:13 +00:00
[Service]
2020-08-29 01:18:45 +00:00
User=root
2020-08-29 01:28:31 +00:00
ExecStart=/usr/local/bin/pf-ui.sh
2020-08-29 01:18:45 +00:00
Restart=always
TTYPath=/dev/tty1
2020-08-28 22:46:13 +00:00
StandardInput=tty
StandardOutput=tty
2020-08-29 01:18:45 +00:00
[Install]
WantedBy=multi-user.target
2020-08-28 22:46:13 +00:00
EOF
# Add fim user and setup fim
2020-08-03 01:05:29 +00:00
useradd -m -G video -s /usr/sbin/nologin fim
apt install acl
2020-08-03 18:01:45 +00:00
setfacl -m "u:fim:rwX" /tank/pictures
setfacl -dm "u:fim:rwX" /tank/pictures
2020-08-03 01:05:29 +00:00
apt install fim imagemagick ttf-dejavu
2020-08-28 22:46:13 +00:00
cat > /usr/local/etc/fimrc < < EOF
2020-08-10 21:30:02 +00:00
# Ensure simages are auto-centered on the screen
2020-08-06 20:59:42 +00:00
_want_autocenter=1;
2020-08-10 21:30:02 +00:00
# Reduce the amount of ram used by dialing back the image cache
_max_cached_images=1;
2020-09-02 22:12:01 +00:00
# Rotate screen if the display used isn't rotated properly (this is for the portrait wisecoco lcds in particular)
#_orientation=1;
2020-08-10 21:30:02 +00:00
# Turn on/off status bar and similar
_display_busy=0;
_display_console=0;
_display_status=0;
_display_status_bar=0;
_display_status_fmt=0;
2020-07-31 23:56:17 +00:00
EOF
2020-08-29 01:18:45 +00:00
# Setup slideshow script stuff
2020-08-28 22:46:13 +00:00
cat > /etc/default/fim_albums < < EOF
2020-08-16 05:52:21 +00:00
/tank/pictures
EOF
2020-08-28 22:46:13 +00:00
cat > /usr/local/bin/pf-fim.sh < < EOF
2020-07-31 23:56:17 +00:00
#!/bin/bash
2020-08-29 01:18:45 +00:00
/usr/bin/chvt 1
/usr/bin/tput -T screen civis > /dev/tty1
#exec </dev/tty1 >/dev/tty1 2>/dev/tty1
2020-08-28 22:46:13 +00:00
#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 \
2020-08-03 07:03:35 +00:00
--device /dev/fb0 --vt 1 \
--execute-commands-early "clear" --final-commands "clear" \
--autozoom --random \
--cd-and-readdir --recursive \
2020-08-16 05:52:21 +00:00
"\$ALBUM_PATH"
2020-07-31 23:56:17 +00:00
EOF
2020-08-28 22:46:13 +00:00
chmod a+x /usr/local/bin/pf-fim.sh
2020-08-03 01:05:29 +00:00
2020-08-29 01:18:45 +00:00
# Setup console config stuff
2020-08-03 07:31:56 +00:00
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
2020-08-28 00:26:56 +00:00
2020-08-29 01:18:45 +00:00
# Setup watcher for filesystem events
2020-08-28 00:26:56 +00:00
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
2020-08-03 23:48:05 +00:00
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
2020-08-28 00:26:56 +00:00
ExecStart=/usr/local/bin/pf-inotify
2020-08-03 23:48:05 +00:00
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
2020-08-03 01:05:29 +00:00
EOF
2020-08-28 22:46:13 +00:00
2020-08-03 23:48:05 +00:00
systemctl daemon-reload
2020-08-28 22:46:13 +00:00
systemctl enable --now no-cursor-tty1
2020-08-29 01:18:45 +00:00
systemctl disable getty@tty1.service
systemctl stop getty@tty1.service
systemctl enable --now pf-ui
2020-08-03 23:48:05 +00:00
systemctl enable --now inotify-pictures
2020-07-31 23:56:17 +00:00
```