If you’ve followed my previous guide on how to synchronize your Google Photos library with a local NAS such as Unraid, you might be looking for a way to display those photos on your TV using Plex. While Plex offers a great way to showcase your local photo albums, it doesn’t automatically update its library after new photos are synced from Google Photos. This can be a bit frustrating if you’re relying on a scheduled sync to keep your photo collection up to date.
In this post, I’ll walk you through the steps to automate the refresh of your Plex photo library right after your Google Photos sync completes, so you’ll always have the latest images ready to view.
Adding Photo Albums to Plex
First, let’s ensure you’ve added your photo albums to Plex. Here’s how to do it:
- Open Plex and navigate to Settings -> Manage -> Libraries.
- Choose “Add Library,” select Photos, and point it to your local NAS folder containing the photo albums.
- If you’re running Plex on Unraid, don’t forget to map the folders in the Docker settings so that Plex can access the photo folders.
To ensure your Plex library stays updated after each scheduled sync, you’ll need to add a simple line of code to your sync script, which I’ll explain in the following steps.
Automating Plex Library Refresh
To automate the refresh of your Plex library, follow these steps:
- Get Your Plex Token:
- Open Plex on your computer.
- Hover over any movie, video, or TV show, click on the hamburger icon that appears over the poster, and select Get Info.
- Click on View XML.
- In the URL that opens, scroll all the way to the right. At the end of the URL, you’ll find something like
X-Plex-Token=xxxxxxxxxxxxxxxxxxxxx
. Copy the string afterX-Plex-Token
—this is your Plex token.
- Find Your Plex Photo Section Number:
- Open your browser and type:
http://192.168.1.69:32400/library/sections?X-Plex-Token=xxxxxxxxxxxxxxxxxxxxxxx
- Replace
xxxxxxxxxxxxxxxxxxxxxxx
with the Plex token you got in the previous step and replace the IP address with your Plex server’s IP address. - In the response, look for
key="x" type="photo"
, wherex
is a number. This number is your section number.
- Open your browser and type:
- Modify Your Google Photos Sync Script:
- Go to your
gphotos-sync
script in Unraid by navigating to Unraid -> Plugins -> User Scripts. - Add the following line at the end of the script:
- Go to your
curl http://192.168.1.69:32400/library/sections/[Section number]/refresh?X-Plex-Token=[token]
Replace [Section number]
with the section number, [token]
with the X-Plex-Token, and the IP address with your Plex server’s IP address.
That’s it! Now, every time your Google Photos sync completes, your Plex photo library will automatically refresh, ensuring your latest images are always available.