Reset all manual poster selections in a library at once or unlock other metadata fields

The following could be most useful for very old libraries, which had their metadata agent already changed several times.
For instance if the server admin has manually selected different posters on many items, but now wants to make a clean break and leave all poster selections to the agent.
While one could do that by deleting the library and re-creating it, it might however be a bit drastic a measure.

What it does:

reset the locked attribute of all poster selections in a given library. Upon the next Metadata Refresh, the poster of each item will be set to whatever the Plex metadata agent will select as most appropriate.

This method is using the Plex server API, which might be safer than editing the server database file directly.

Preparation:

  1. You need access to the curl command or have an equivalent way of sending commands per http to your server. (There is also a Windows version of curl available.)

  2. Determine the library ID number of your Plex library.
    You can get it from the Plex XML info of one of this library’s items (or by simply hovering the mouse cursor over the library name of this library in the web app)

  3. Get a valid X-Plex-Token
    https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/

  4. Build yourself some queries:
    (Unlocking the thumbnails for movies, tv shows, tv show seasons, tv shows episodes need to be done separately.
    This is the type parameter in these lines.)

Execution

Each line will unlock the thumbnail selections of all items in a library of a certain type at once.

curl -X PUT "me.local:32400/library/sections/NN/all?type=1&thumb.locked=0&X-Plex-Token=XXXXX"
curl -X PUT "me.local:32400/library/sections/NN/all?type=2&thumb.locked=0&X-Plex-Token=XXXXX"
curl -X PUT "me.local:32400/library/sections/NN/all?type=3&thumb.locked=0&X-Plex-Token=XXXXX"
curl -X PUT "me.local:32400/library/sections/NN/all?type=4&thumb.locked=0&X-Plex-Token=XXXXX"
  • replace me.local by the IP address or the domain name of your Plex server
  • replace NN by the library ID of your music library
  • replace XXXXX with your X-Plex-Token

The following is a reference list of item types to be used with the type parameter.
(Not all of these types are actually used in Plex!)

‘Movie’ : 1, ‘Show’ : 2, ‘Season’ : 3, ‘Episode’ : 4, ‘Trailer’ : 5, ‘Comic’ : 6, ‘Person’ : 7, ‘Artist’ : 8, ‘Album’ : 9, ‘Track’ : 10, ‘Clip’ : 12, ‘Photo’ : 13, ‘Photo_Album’ : 14, ‘Playlist’ : 15, ‘Playlist_Folder’ : 16, ‘Podcast’ : 17
(shamelessly copied from the old WebTools source code)

Caution: with large libraries and/or slower servers, it can take several minutes to execute these commands. Don’t get impatient and leave your server undisturbed while it chews through your library’s items.

What it does NOT do:

You could change the query and use thumb.locked=1 instead, to change all poster selections to “locked” state. i.e. as if you had selected a poster manually on each item.
However, the usefulness of this is limited – particularly when you change the metadata agent afterwards. Because a different metadata agent might also provide a different list of posters to choose from. Locking the poster won’t preserve the poster which was delivered by the previously used metadata agent – simply because it might not be available anymore.


Other uses: There are other uses for this method of API access.

5 Likes