Plex Sync

:placard: Summary Refresh Plex metadata when scene updated in Stash. Requires the StashPlexAgent.bundle agent.
:link: Repository https://github.com/stashapp/CommunityScripts/tree/main/plugins/PlexSync
:information_source: Source URL https://stashapp.github.io/CommunityScripts/stable/index.yml
:open_book: Install How to install a plugin?

Stash Plugin updating your Plex metadata automatically

This plugin solves the problem of “I have many files in my Plex, but they don’t get any of the changes I do in Stash, and doing a refresh all metadata takes too much time”.

With this, Stash behaves as the main source for all your Stash scenes in Plex, and it keeps Plex in sync with changes done via Stash.

Install

Install the plugin in Stash first, and then install the updated StashPlexAgent.bundle on your Plex server.

Stash side

  1. Install plugin via the CommunityScripts repository.

  2. Go to the install directory and install requirements: python3 -m pip install -r requirements.txt -t . – or, install the required packages globally python3 -m pip install stashapi unidecode requests

  3. Configure the plugin in Stash UI.

Plex side

Do this after making sure the Stash side is complete.

  1. After installing the newest version of this agent, make sure that AddPlexURL is enabled (“Adds the Plex media ID to the scene in Stash; allows Stash to update Plex metadata.”)

  2. Refresh all metadata in Plex for the libraries using this agent.

Now, you should see scenes being updated in Stash, adding this URL to the scenes: plex/library/metadata/12345 (12345 being the metadata ID of the scene in Plex)

Usage

Update your scenes in Stash like normal, and these scenes will be automatically refreshed in Plex. :tada:

Warnings

  • If you have the “clean titles” option enabled in plugin, all titles are processed with unidecode. Basically, all non-ASCII characters in your titles will be converted; Cyrillic script for example will be taken away.

  • This plugin connects to your Plex via TLS, but it ignores cert errors. But this is not really a problem, as your Stash is most likely on the same host as your Plex…

2 Likes

How do you install the python modules when you run in docker?

I don’t use Stash in Docker, but it should be straightforward enough: on your host running the container, do docker exec -it stash /bin/sh – and now you’re inside the container.

Once inside the container, you can then cd ~/.stash/plugins/community/PlexSync. Then python3 -m pip install -r requirements.txt -t . and then all dependencies are installed.

You could also run something like apk add py3-unidecode inside the container and that’d fix the missing unidecode globally, as I assume that’s the only module missing from Stash vanilla container.

(Already replied on Github but better here for visibility :))

2 Likes