Ausgelagert aus: Informationen im Eingangsbereich darstellen
Klar sind wir neugierig.
Na gut, hier ist der aktuelle Stand, sozusagen als Schnappschuss (von meinem Repository https://github.com/rpi-simonz/rpifbss).
Die Dokumentation ist auf Englisch, sorry about that!
Script-Quelltext im Spoiler:
Display Spoiler
#!/usr/bin/env bash
#
# rpifbss - Raspberry Pi Framebuffer Slideshow by rpi-simonz Nov. 2024
# >>>> Configuration section
SECONDS_PER_IMAGE=3
BLEND_MILLISECONDS=800
MAINTENANCE_MSG_DEFAULT="*** Maintenance running. Please be patient. ***"
# <<<< End
function print_info() {
cat <<EOF
===============================================================================
rpifbss - Raspberry Pi Framebuffer Slideshow
--------------------------------------------
This program provides a simple framebuffer slideshow from a directory of files.
It uses software 'fbi' for that. So only still images are possible, no videos.
PDF files are displayed as well.
Even short text files (with extension .txt) are converted to images and shown.
The directory containing the files to be displayed can be defined by the first
commandline argument. Otherwise the current working directory is used.
To have a comfortable environment it is recommended to start this program
in a 'tmux' or 'screen' session. Then the running slideshow is always
accessible, even remotely via an SSH connection.
The slideshow can be controlled interactively with fbi's key shortcuts.
'h' lists them on the framebuffer display
'q' stops the current slideshow, and then
* reads in possible new or modified files
* converts unseen text files and
* restarts the slideshow with the new contents
===============================================================================
EOF
}
function print_shortcuts() {
cat <<EOF
keyboard commands
~~~~~~~~~~~~~~~~~
cursor keys - scroll image
PgUp, k - previous image
PgDn, SPACE, j - next image
<i>g - jump to image #i
a - autozoom image
+/- - zoom in/out
<i>s - set zoom to <i>%
ESC, q - quit *** and restart with possibe new contents ***
v - toggle statusline
h - show this help text
i - show EXIF info
p - pause slideshow
available if started with --edit switch,
rotation works for jpeg images only:
D, Shift+d - delete image *** really, without confirmation dialog! ***
r - rotate 90 degrees clockwise
l - rotate 90 degrees counter-clockwise
x - mirror image vertically (top / bottom)
y - mirror image horizontally (left to right)
Ctrl-C ends this program and therfore the slideshow completely.
EOF
}
function txtfiles2jpg() {
# convert text files from current directory to jpg images
# the image background (and more) can be configured and choosen by an optional argument
typ="$1"
OPTS=""
case $typ in
error|red) OPTS="-background red" ;;
warning|yellow) OPTS="-background yellow" ;;
esac
for f in *.txt ; do
img="${f}.jpg"
if [ ! "$f" -nt "$img" ] ; then
echo "'$img' already existing and up-to-date"
continue
fi
echo "Converting '$f' to jpg."
convert $OPTS -size 400x caption:@- "${img}" < "$f"
done
}
function prepare_maintenance_dir() {
# optionally create maintenance directory and default maintenance files
mkdir -p $MAINTENANCE_DIR
[ -f $MAINTENANCE_MSG_FILE ] || echo "$MAINTENANCE_MSG_DEFAULT" > $MAINTENANCE_MSG_FILE
pushd $MAINTENANCE_DIR
txtfiles2jpg red
popd
}
function maintenance() {
# check for files not yet converted to jpg and convert them
# display an appropriate message during the conversion
echo ""
echo "----- Maintenance running. Be patient. -------"
fbi -d /dev/fb0 --nointeractive --noverbose -a ${MAINTENANCE_MSG_FILE}.jpg </dev/null 2>$SAVE_STDERR_TO &
fbipid=$!
txtfiles2jpg
kill $fbipid
echo "----------------------------------------------"
}
function list_images() {
find . -maxdepth 1 -type f ! \( -name "*.txt" -o -name "*.md" -o -name "$MYNAME" -o -name "stderr.log" \) -print | sort
}
#=============================================================================
if [ "$1" == "-h" ] ; then
print_info
print_shortcuts
exit
fi
IMAGE_DIR=${1:-$PWD}
if [ ! -d "$IMAGE_DIR" ] ; then
echo "Error: Provided directory '$IMAGE_DIR' not existing!?"
exit 1
fi
cd $IMAGE_DIR || exit 1
IMAGE_DIR=${PWD}
MAINTENANCE_DIR=${IMAGE_DIR}/maintenance
MAINTENANCE_MSG_FILE=${MAINTENANCE_DIR}/maintenance.txt
SAVE_STDERR_TO="/dev/null"
#SAVE_STDERR_TO="stderr.log"
MYNAME=$(basename $0)
MYVERSION=$(fbi -V | head -1 | awk '{sub(/,/,"",$3); print $3;}')
if [[ "$MYVERSION" < "2.14" ]] ; then
echo -e "\nError: Program 'fbi' is too old! Please update to version 2.14 or newer!"
echo -e " Probably it needs to be compiled from source."
echo -e " See README.md for details.\n"
exit 3
fi
print_info
prepare_maintenance_dir
trap exit INT
echo -e "\nThe following images/files will be displayed in this (alphabetical) order:\n"
list_images
echo ""
while true ; do
maintenance
IMAGES=$(list_images)
echo ""
print_shortcuts
fbi --device /dev/fb0 --noverbose --edit --backup --autozoom --blend $BLEND_MILLISECONDS --timeout $SECONDS_PER_IMAGE $IMAGES 2>$SAVE_STDERR_TO
done
Display More
rpifbss - Raspberry Pi Framebuffer Slideshow
This program provides a simple framebuffer slideshow from a directory of files.
It uses the software 'fbi' for that. So only still images are possible, no videos.
PDF files are displayed as well. Even short text files (with extension .txt) are converted to images and shown.
The directory containing the files to be displayed can be defined by the first commandline argument. Otherwise the current working directory is used.
The slideshow can be controlled interactively with fbi's key shortcuts.
- 'h' lists all of them on the framebuffer display, see below
- 'q' stops the current slideshow, and then
- reads in possible new or modified files
- converts unseen text files
- and restarts the slideshow with the new contents
keyboard commands
~~~~~~~~~~~~~~~~~
cursor keys - scroll image
PgUp, k - previous image
PgDn, SPACE, j - next image
<i>g - jump to image #i
a - autozoom image
+/- - zoom in/out
<i>s - set zoom to <i>%
ESC, q - quit
v - toggle statusline
h - show this help text
i - show EXIF info
p - pause slideshow
available if started with --edit switch,
rotation works for jpeg images only:
D, Shift+d - delete image *** really, without confirmation dialog! ***
r - rotate 90 degrees clockwise
l - rotate 90 degrees counter-clockwise
x - mirror image vertically (top / bottom)
y - mirror image horizontally (left to right)
Display More
During re-reading and possibly converting new files, what can need several seconds, there is a maintenance message displayed.
This message is stored in a text file in the automatically created subdirectory 'maintenance/' and can be adapted to individual needs.
Ctrl-C ends this program and therfore the slideshow completely.
The configuration is done in the script rpifbss itself, in a 'Configuration section' at the beginning.
To have a comfortable environment it is recommended to start rpifbss in a tmux or screen session.
Then the running slideshow is always accessible, even remotely via an SSH connection.
Requirements and preparations
Raspberry Pi OS
Tested with Bookworm (Debian 12) 64-Bit Desktop. TODO: Test lite version.
Should work on older releases too, but that has not been tested yet.
fbi with current version 2.14 or newer
The really old version 2.09 included in Raspberry Pi OS doesn't work well. So we need to compile fbi ourselves from source...
Compile fbi from source
Download fbida-master.zip from https://github.com/kraxel/fbida
Then - in a terminal - change into the folder where the downloaded file is, and:
unzip fbida-master.zip
cd fbida-master
# Install dependencies
sudo apt install -y meson
sudo apt install -y cmake
sudo apt install -y libpoppler-glib-dev
sudo apt install -y libdrm-dev
sudo apt install -y libexif-dev
sudo apt install -y libtiff-dev
sudo apt install -y libudev-dev
sudo apt install -y libinput-dev
sudo apt install -y libtsm-dev
sudo apt install -y libsystemd-dev
sudo apt install -y libgif-dev
sudo apt install -y libxkbcommon-dev
make
# For a short test
build-meson-${HOSTNAME}/fbi -d /dev/fb0 ~/some_image.jpg
Display More
Unfortunately the provided Makefile has a missing target entry...
Edit it with
and add these two lines at the bottom (important: That's a leading TAB in the second line!):
Following the fbida documentation won't work on standard Raspberry Pi OS because the user root isn't usable there by default.
Instead of
better use this:
In case the original old fbi is already/still installed it is recommended to uninstall it:
Or at least we should clean up the current shell's cache by:
Some of ImageMagick's policy restrictions need to be adapted
The following two entries need to be commented out as shown:
<!-- <policy domain="path" rights="none" pattern="@*"/> -->
<!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
Additionally show some more configured limits for ImageMagick:
The system should be using the multi-user target, not the graphical one
List available targets:
Stop graphical desktop:
# temporarily:
sudo systemctl isolate multi-user
# permanently (recommended):
sudo systemctl set-default multi-user
sudo systemctl isolate multi-user
TODO: Check 'lite' systems and update this readme if needed.