PLUGIN: slideshow v:0.1.2
FUNCTION: update_function
update function for slideshow plugin
This plugin choose an image from a specified directory and displays it
along with some optional information such as the time and a filename.
Images are displayed in either `random` or `sequential` order.
Each time the plugin runs the `image_path` is re-indexed. If images are added
or removed from the `image_path`, they will be used in the rotation.
Requirements:
self.config(dict): {
'image_path': '/absolute/path/to/images',
'order': 'random',
}
Args:
self(namespace): namespace from plugin object
Returns:
tuple: (is_updated(bool), data(dict), priority(int))
___________________________________________________________________________
SAMPLE CONFIGURATION FOR paperpi.plugins.slideshow.slideshow
[Plugin: Slideshow]
# default layout
layout = layout
plugin = slideshow
# time between choosing new image (seconds)
refresh_rate = 90
# recommended display time (seconds)
min_display_time = 50
# maximum priority in display loop
max_priority = 2
# path to image directory
image_path = /pi/documents/images
# order to pull images in: random, sequential
order = random
# frame style to use (see README)
frame = black & silver: matted
LAYOUTS AVAILABLE:
image_only_centered_blackbkground
image_only_centered_whitebkground
image_time_centered_blackbkground
image_time_centered_whitebkground
layout
DATA KEYS AVAILABLE FOR USE IN LAYOUTS PROVIDED BY paperpi.plugins.slideshow.slideshow:
time
filename
image
layout: RGB image_only_centered_blackbkground
layout: image_only_centered_blackbkground
layout: RGB image_only_centered_whitebkground
layout: image_only_centered_whitebkground
layout: RGB image_time_centered_blackbkground
layout: image_time_centered_blackbkground
layout: RGB image_time_centered_whitebkground
layout: image_time_centered_whitebkground
layout: RGB layout
layout: layout
image_path = /full/path/to/source/images
order = sequential | random
frame = frame style | random
image_path
: is the full path to the images that should be used for each update (see the Removable Media section if you intend to use a USB drive or similar)order
: choose eithersequential
orrandom
frame
: choose one of the frame styles below orNone
black & silver: matted |
dim-gray & silver: matted |
thick black: matted |
thin black: matted |
thick black |
thin black |
none |
random (choose random frame style) |
Valid Frame Values:
- black & silver: matted
- dim-gray & silver: matted
- thick black: matted
- thin black: matted
- thick black
- thin black
- none
This section only applies to users that have the Raspberry Pi graphical interface installed. If you are using the lite
version of Raspberry Pi OS, you can likely skip this.
The PCManFM file manager that ships with GTK+ will automatically mount USB drives when they are inserted. PCManFM mounts these in such a way that only the current user can access the files. If you are running PaperPi in daemon mode, it will not be able to access the images on the drive. You will likely see log errors like the ones shown below.
21:09:20 slideshow:_index_images:63 :WARNING - failed to index images in directory: [Errno 13] Permission denied: '/mnt/foo'
21:09:20 slideshow:update_function:282 :WARNING - no images were found in /mnt/foo
21:09:20 slideshow:update_function:285 :WARNING - falling back to /home/pi/src/PaperPi_stable/paperpi/plugins/slideshow/fallback_images
To resolve this you will need to disable the automount feature of PCManFM and use automount
.
WARNING These steps will make it so any user on the Pi can read the USB drive. If you're OK with this, proceed.
- Eject any USB sticks/external drives you have attached
- Open PCManFM by double clicking on the icon or running
pcmanfm
from a terminal window - Click Edit > Preferences > Volume Management
- Uncheck "Mount removable media automatically when they are inserted" and "Show available options for removable media when they are inserted"
- Install usbmount
sudo apt install usbmount
- confirm the permissions on
/media/pi
by runningls -alh /media/
You should see output like below. The important thing is that the permissions are set asdrwxr-x-rx
for thepi
directory. If they are not runsudo chmod 755 /media/pi
to fix them.
$ ls -alh /media
drwxr-xr-x 3 root root 4.0K Dec 10 12:42 .
drwxr-xr-x 18 root root 4.0K Sep 22 02:25 ..
drwxr-xr-x 3 root root 8.0K Jan 1 1970 pi
- Insert a USB drive. The default should be to mount with the permissions
rwxr-xr-x
which should allow all users to use the removable media.
If the slideshow plugin fails to access the configured image path, it will fall back to several supplied images. The included images were sourced from the Flicker Biodiversity Heritage Library.
@PaperCloud10 -- I#72