[implemented] Plex Home inverse filter, blacklist

It’s Friday night, Anna’s working late, so why not drop a bit of holiday cheer in this thread?

N.B. This is an advanced trick. Use at your own risk. This may stop working in the future. It may cause your computer to overheat or catch on fire, but only if your computer is a Samsung Galaxy Note 7.

Background: The restrictions feature in Plex Home uses the same powerful filtering system used by the filtering UI when you’re in a media grid (this in itself doesn’t expose the full power of the system, but we digress). For the Plex Home UI, we chose to expose a simple subset which we thought struck the right balance between simplicity and functionality, but regardless of the balance one strikes, there are always some people on the side which desires more power, amirite?

Hacking the System: Bring up Chome, with the debugging tools showing, and watch the network requests. When you edit restrictions for a user, you’ll see something like the following request (edited for clarity):

PUT https://plex.tv/api/users/99999?allowSync=0&allowCameraUpload=0&allowChannels=0&filterMovies=contentRating%3DG&filterTelevision=contentRating%3DTV-G%252CTV-PG&filterMusic=&filterPhotos=label%3DDog&X-Plex-Token=shhh

If you decode the various filter parameters (e.g. filterMovies) you’ll see that it contains a querystring fragment which looks identical to those querystrings used when using the aforementioned media grid filters.

Now let’s say instead of allowing Barkley to watch only G-rated movies, we’d rather allow him to see anything except X and R rated movies. This filter looks like contentRating!=X&contentRating!=R. So we modify the URL to contain the (encoded) fragment filterMovies=contentRating!%3DX%26contentRating!%3DR. Execute the request at the terminal with something like curl -X PUT https://.... If it worked, you’ll see the filter come back in the XML response:

<User filterMovies="contentRating!=X&contentRating!=R" />

If you switch to the account and check the content rating filters, you’ll see that R and X no longer appear, because all such movies have been filtered out.

What are some things other things you can do with this trick:

  • Use other fields entirely (year<=1938 if you don’t want to scare your grandparents with color movies, e.g.)
  • Combine positive and negative conditions (e.g. contentRating=G&year!=2016 because it’s been such a bad year that we’ll just completely ignore all movies made in it).

Caveat emptor: If you set a custom filter like this, the UI will show them as blank, as it doesn’t know how to interpret them, and probably won’t roundtrip them correctly.

Caveat emptor secundo: negative “tag” filters (e.g. “label is not X” or “genre is not Y” or “actor is not brad pitt”) don’t currently work. It turns out to be a four-year old silly bug which I’ve fixed, and will likely be in the next 1.3.x server release.

2 Likes