Code Monkey home page Code Monkey logo

syno-photo-frame's Introduction

Syno Photo Frame

Synology Photos full-screen slideshow for Raspberry Pi.

Features include speed control, transition effects, and a blurry background fill.

Extra space gets blurry background

If you like the project, give it a star โญ, or consider becoming a :)

Why?

I developed this app for a DIY digital photo frame project using a Raspberry Pi connected to a monitor (it runs great on Pi Zero 2). The goal was to fetch photos directly from my Synology NAS over LAN.

Why not use Synology Photos in a web browser directly? There are two reasons. First, the current version of Synology Photos (1.6.x at the time of writing) does not allow slideshow speed adjustments and changes photos every 3 or 4 seconds - way too fast for a photo frame. Second, running a full web browser is more resource-demanding than a simple static image app, which matters when using a Raspberry Pi, especially in the Zero variant.

Setup

Synology Photos (NAS)

Assuming the Synology Photos package is installed on DSM:

  1. Create an album in Synology Photos and add photos to it (note the distinction between an "album" and a "folder").
  2. Click the "Share" button in the album.
  3. Check the "Enable share link" option.
  4. Copy/write down the Share Link - you'll need it when setting up the app on Raspberry Pi later on.
  5. Set Privacy Settings to one of the "Public" options.
  6. Optionally, enable Link Protection. If a password is set, you will need to provide it using the --password option when running the app on Raspberry Pi. In the case of accessing Synology Photos over the internet or an untrusted LAN, I recommend making sure your share link uses the HTTPS (not HTTP) scheme to prevent exposing the password.
  7. Click Save.

Album Sharing

Raspberry Pi

Let's assume that you're starting with a fresh installation of Raspberry Pi OS Lite, the network has been set up (so you can access Synology Photos), and you can access the command line on your Pi.

Option 1: Install From Debian Package

Releases contains pre-built .deb packages for arm64 Linux architecture, which should work on Raspberry Pi 3 and up, as well as Zero 2 (assuming the 64bit version of Raspbian OS Bookworm is installed).

  • Check the architecture with dpkg --print-architecture; it should print "arm64".
  • Check the installed version of Debian with lsb_release -c and make sure it says "bookworm".

For other platforms (including older versions of Debian, such as "bullseye"), you must build the project from source - see Option 2: Build From Source.

  1. Download the syno-photo-frame_X.Y.Z_arm64.deb package from Releases.

  2. Update the system:

    sudo -- sh -c ' \
    apt update && \
    apt upgrade -y'
  3. cd to the directory where the package has been downloaded and install the app:

    sudo apt install ./syno-photo-frame_*_arm64.deb

Option 2: Build From Source

Note: These instructions assume a Debian-based Linux distribution, but adjusting them should make it possible to build the app for almost any platform where Rust and SDL are available.

  1. Install Rust if you have not already (or use the Alternative: Build With Docker approach).

  2. Install build dependencies:

    sudo -- sh -c ' \
    apt update && \
    apt upgrade -y && \
    apt install -y \
        libsdl2-dev \
        libssl-dev'
  3. Install the app from crates.io (you can use the same command to update the app when a new version gets published):

    cargo install syno-photo-frame

When building is finished, the binary is then located at $HOME/.cargo/bin/syno-photo-frame and should be available on your $PATH.

Alternatively, clone the git repository and build the project with (in the cloned directory):

cargo build --release

The binary is then located at target/release/syno-photo-frame.

Alternative: Build With Docker

If you don't want to install Rust or the build dependencies for some reason but have Docker available, you can build the binary and/or Debian package in a container using the provided Dockerfile. See instructions in the file to build the app this way.

Run

Display the help message to see various available options:

syno-photo-frame --help

Run the app:

syno-photo-frame {sharing link to Synology Photos album}

If everything works as expected, press Ctrl-C to kill the app.

Optional Stuff

Increase the Swap Size on Raspberry Pi Zero

A 100 MB swap file may be too small when running on low-memory systems such as Pi Zero. See Increasing Swap on a Raspberry Pi.

Auto-start

To start the slideshow automatically on boot, you can add it to crontab:

crontab -e

Add something like this at the end of crontab:

@reboot    sleep 5 && /bin/syno-photo-frame https://{share_link} >> /tmp/syno-photo-frame.log 2>&1

Remember to replace your share link with a real one and adjust the binary path depending on the installation method (dpkg or from crates.io). A short sleep is required to not start before some services (network) are up - try to increase it if errors occur. The above command redirects error messages to a log file /tmp/syno-photo-frame.log.

For other (untested) alternatives, see e.g. this article.

Startup-Shutdown Schedule

A proper digital photo frame doesn't run 24/7. Shutdown can be scheduled in software only, but for startup, you'll need a hardware solution, e.g. for Raspberry Pi Zero, I'm using Witty Pi 3 Mini.

Auto Brightness

For my digital photo frame project, I attached a light sensor to Pi's GPIO to adjust the monitor's brightness automatically depending on ambient light. TSL2591 is an example of such sensor. Check out my auto-brightness-rpi-tsl2591 project to add automatic brightness control to your digital photo frame.

Start from a Random Photo and in Random Order

By default, photos are displayed in the order of the shooting date. If the album is very large, and the startup-shutdown schedule is short, potentially the slideshow might never reach some of the later photos in the album. The --random-start option solves this problem by starting the slideshow at a randomly selected photo, then continuing normally (in the order of the shooting date). Adding this option to the startup schedule will start at a different photo every time.

Alternatively, use --order random to display photos in a completely random order.

Change the Transition Effect

Use the --transition (or -t) option to select the type of transition effect for changing photos. Use --help option to display valid values.

Customize the Splash-Screen

You can replace the default image displayed during loading of the first photo. Use the --splash option to point the app to a .jpeg file location.

Supported By

syno-photo-frame's People

Contributors

caleb9 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

syno-photo-frame's Issues

Not working with NAS

Hi there,

i just found this neat piece of software and was trying out a while, but i am not able to get it up running. I would be happy to be able to use it for our kiosk monitors in space.

the following command does not work correctly:

export XDG_RUNTIME_DIR=/home/himbeere/Downloads && ./syno-photo-frame/target/release/syno-photo-frame https://nas.stadtfabrikanten.org/photo/mo/sharing/RmncHcRjv

the program does not fetch images. it only shows the splash default image. No errors anywhere. The link is working correctly. If i trace the links then i get to the page which says 404 not found:

curl -c cookie https://nas.stadtfabrikanten.org/photo/webapi/entry.cgi -d 'api=SYNO.Core.Sharing.Login&method=login&version=1&sharing_id=RmncHcRjv'
curl -k -b cookie 'https://nas.stadtfabrikanten.org/photo/mo/sharing/webapi/entry.cgi?id=25752&cache_key="25752_1633656385"&type="unit"&size="sm"&api="SYNO.Foto.Thumbnail"&method="get"&version=1&_sharing_id="RmncHcRjv"'

i have no idea why. i guess sth changed belonging to API? i already checked a lot of stuff like domain rebinding, portal short link /photo/, ports, etc. - also tried with local ip address. no difference.

i was able to get it running with 1 other NAS system and it failed also on another NAS. So i tried it out on three different systems.

The device where it is working:

  • DSM 7.1.1-42962 Update 5 / hardware DS218j
    The devices where it is not working
  • DSM 7.1.1-42962 Update 5 / hardware DS718+
  • DSM 7.2-64570 Update 1 / hardware RS819

can you maybe help out?

Can I start a debug output?

Now it has happened, the micro SD card has said goodbye, so no backup, reinstall.
Pi-OS Lite 04.07.2024, syno-foto-frame 0.12.1 , latest.

So far, so good, the shared link has not changed.
After starting, I only see the process, no output on the screen.
Is there a --debug to find out what the process is doing?

Request for video playback

Is it possible to include playback of videos on the album?

I have a video in the shared album but it only shows the thumbnail image.

Loving the app. this is something I have wanted to make the Synology system even better. I have this running on a PI3 b+.

Feature request: being able to display the pictures in a random order

Wow I have just try to build your app and it's running well on my raspberry pi zero 1 (32 bits)! thank you very much.
Using a synology photo album link is very clever and convenient ๐Ÿ‘

However one feature is missing: I have seen I can start the slideshow at a random photo, but do you plan to implement a way to choose the next photo randomly? Maybe you don't need it but I think it would be a nice improvement.

Start and (!) stop with crontab

I need your help again, my Linux time was a while ago.

I had tried, as you explained, to start syno-photo-frame via the crontab after the reboot.
Unfortunately this did not work, it was missing some environment variables on startup, even on delayed startup.

So I created a script under /etc/xdg/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
syno-photo-frame --order random -i 5

This now works, after every restart via "Witty Pi 3 Mini" syno-photo-frame starts at 5 o'clock in the morning.
And AdGuardHome also starts in the background. The system then goes back to sleep at midnight.

Now I want syno-photo-frame to start at 3 pm and stop at 10 pm.
But ... the system (because of AdGuardHome, bin homecameras) must be run's all day, all time (basically I don't need a Witty Pi 3 Mini).

A solution via the crontab unfortunately fails because of the stop script.
A simple search for the process ID and then kill.

After the kill, the restart of syno-photo-frame unfortunately ends with ...
The path /dev/dri/ cannot be opened or is not available
The path /dev/dri/ cannot be opened or is not available
2023-12-10T14:26:50.011Z ERROR [syno_photo_frame] No available video device
Error: "No available video device"

My Start-Skript
#!/bin/ksh

Info : /etc/xdg/lxsession/LXDE-pi/autostart

syno-photo-frame --order random -i 5

My Stop-Skript
#!/bin/ksh

Info : /etc/xdg/lxsession/LXDE-pi/autostart

date >>/home/rasp/logs/foto.log
pidof syno-photo-frame &>>/home/rasp/logs/foto.log
sudo kill -9 pidof syno-photo-frame &>>/home/rasp/logs/foto.log

Any tip, can you help me (again) :)
thx Erik

blurry background fill

super great app.I love it.works fine and stable on my device. but I still have a little suggestion about the backguound.
is there any way to chose the black fill to replace blurry background? Or can I expect in the next version update?

Many Thanks!!

Hello Piotr,
I would like to take this opportunity to thank you very much for your development work.
Finally my Raspberry 3 B 1.2 has got a purpose again, additionally PI-Hole replaces my ancient USB photo frame (anno 2004).
I hug you and wish you good health, lots of strength and lots of lovely people around you for a very long time to come.

Best regards
Erik
From Germany, Friesland .... Schortens (near Jever)

Create deb package for Debian 12 (bookworm)

So far I have failed to generate a .deb package that would work on both Debian 11 and 12 based Raspberry Pi OS.

The system version of libssl library changed from version 1.1 to 3, so building the package on Debian 12 requires version 3, which is not available on Debian 11. Statically embedding the library in the binary (using native-tls-vendored feature of reqwest crate) also doesn't work because of different GCC versions on both systems (the app crashes immediately complaining about missing GLIBC libs).

SSL / TLS Error

Hello

Great project initiative. Thank you!

Hope you can assist. I am getting the below error when following the instructions:

OS: bullseye lite (64 bit)

Error:

2024-01-07T02:48:00.688Z ERROR [syno_photo_frame] error sending request for url (https://192.168.0.200:5001/?launchApp=SYNO.Foto.AppInstance#/shared_space/folder/webapi/entry.cgi): error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1919: (unable to get local issuer certificate)

Time interval between picture changes

Switching between the images takes a long time, I haven't stopped it, but a bit faster would be nice.

I'm currently using WLAN, LAN would also be possible.
I don't know exactly, are the images transferred from the NAS in full size?
I can't configure the transfer size in the album (Synology), does the API offer this?

But maybe there is still a delay in syno-photo-frame.
Is there a fixed time interval between the individual image changes that can be set (parameter, config file)?
If so, it would be nice if this could be changed externally (argument, config).
BR
Erik

the image format could not be determined

Hello,

I have just installed version 0.7.0 and unfortunatelly I am getting fail message "The image format could not be determined". Share link is in format http://{myNasIP}:5000/mo/sharing/d6QunxSCC and is set to view for all with a link.

Could you please give me advice where could be problem?

Thank you in advance!

Question more than an Issue

First off @Caleb9 awesome job on the project. I found your project and it adds a ton of functionality I found lacking on the synology photos app. I have a similar problem I'm trying to solve but instead of displaying photos on a photo album I'm using a RaspberryPi3 to display a Dakboard for our family calendar. It has photo integrations to display photos from popular storage such as Dropbox, Apple Photos, Flickr, Google Drive etc. The functionality I'm trying to leverage is the "custom url" where it can display a photo.

Does the syno-photo-frame serve a http(s) url that I could leverage for this functionality? If not, I believe you have the connectivity and information needed for me to use as a foundation.

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.