piframe/docs/slideshow.md

247 lines
5.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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
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 > /home/fim/.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=1;
# Turn on/off status bar and similar
_display_busy=0;
_display_console=0;
_display_status=0;
_display_status_bar=0;
_display_status_fmt=0;
unbind " ";
unbind "!";
unbind """;
unbind "#";
unbind "$";
unbind "%";
unbind "&";
unbind "";
unbind "(";
unbind ")";
unbind "*";
unbind "+";
unbind ",";
unbind "-";
unbind ".";
unbind "/";
unbind "0";
unbind "1";
unbind "2";
unbind "3";
unbind "4";
unbind "5";
unbind "6";
unbind "7";
unbind "8";
unbind "9";
unbind ":";
unbind ";";
unbind "<";
unbind "=";
unbind ">";
unbind "?";
unbind "@";
unbind "A";
unbind "Any";
unbind "B";
unbind "BackSpace";
unbind "Backspace";
unbind "C";
unbind "C-a";
unbind "C-b";
unbind "C-c";
unbind "C-d";
unbind "C-e";
unbind "C-f";
unbind "C-g";
unbind "C-h";
unbind "C-i";
unbind "C-j";
unbind "C-k";
unbind "C-l";
unbind "C-m";
unbind "C-n";
unbind "C-o";
unbind "C-p";
unbind "C-q";
unbind "C-r";
unbind "C-s";
unbind "C-t";
unbind "C-u";
unbind "C-v";
unbind "C-w";
unbind "C-x";
unbind "C-y";
unbind "C-z";
unbind "D";
unbind "Del";
unbind "Down";
unbind "E";
unbind "End";
unbind "Enter";
unbind "Esc";
unbind "F";
unbind "G";
unbind "H";
unbind "Home";
unbind "I";
unbind "Ins";
unbind "J";
unbind "K";
unbind "L";
unbind "Left";
unbind "M";
unbind "N";
unbind "O";
unbind "P";
unbind "PageDown";
unbind "PageUp";
unbind "Q";
unbind "R";
unbind "Right";
unbind "S";
unbind "T";
unbind "Tab";
unbind "U";
unbind "Up";
unbind "V";
unbind "W";
unbind "X";
unbind "Y";
unbind "Z";
unbind "[";
unbind "\";
unbind "]";
unbind "^";
unbind "_";
unbind "";
unbind "a";
unbind "b";
unbind "c";
unbind "d";
unbind "e";
unbind "f";
unbind "g";
unbind "h";
unbind "i";
unbind "j";
unbind "k";
unbind "l";
unbind "m";
unbind "n";
unbind "o";
unbind "p";
unbind "q";
unbind "r";
unbind "s";
unbind "t";
unbind "u";
unbind "v";
unbind "w";
unbind "x";
unbind "y";
unbind "z";
unbind "{";
unbind "|";
unbind "}";
unbind "~";
EOF
cat > /etc/default/fim_album_path <<EOF
/tank/pictures
EOF
cat > /usr/local/bin/fim-slideshow.sh <<EOF
#!/bin/bash
ALBUM_PATH=\`cat /etc/default/fim_album_path\`
# options inspiration: https://www.raspberrypi.org/forums/viewtopic.php?t=196043
tput civis
/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/fim-slideshow.sh
cat > /etc/systemd/system/fim.service <<EOF
[Unit]
Description=fim slideshow
After=getty.target
[Service]
User=fim
ExecStart=/usr/local/bin/fim-slideshow.sh
Restart=always
RuntimeMaxSec=604800
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl stop getty@tty1
systemctl disable getty@tty1
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
systemctl daemon-reload
systemctl enable --now no-cursor-tty1
systemctl enable --now fim
git clone https://git.kemonine.info/kemonine/piframe.git /opt/piframe
cp /opt/piframe/inotify-pictures.py /usr/local/bin/
chmod a+x /usr/local/bin/inotify-pictures.py
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/inotify-pictures.py
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now inotify-pictures
```