How To Plex

Why and how to move Plex viewstate details between accounts

Plex is a great piece of kit. It allows you to build your own Netflix-ish media server and watch your content from anywhere. You can add multiple “managed” users (if you have a Plex Pass) and the server will keep track of what they watched, where they stopped and how they rate content. A feature many people know from Netflix and other streaming services. Plex also allows you to share your server with other users, giving them access to your content as well. The server, however, is only shared with an account’s main/admin user. That account’s managed users will not be able to see or access the shared server. Just to make this a bit clearer, here is what the account structure would look like:

- Plex account A, owns server X, shares server with B
- Plex account B, owns server Y
  - admin user B0, has access to server Y *and* shared server X
  - managed user B1, only has access to server Y
  - managed user B2, only has access to server Y

So, even though account A shares their server with account B, B’s managed users to not have access to the shared server. Plex does list this limitation in their managed user documentation, but it is not something most users will be aware of – until someone shares their server with them. The only workaround I could find was a post from one on the Plex forum moderators.

Create a full user account for your partner. Share your server with this new account. Ask your friend to share his server with this new account as well. If you have Plex pass, invite this account additionally into your Plex Home.

That way you get a “hybrid” account, which appears on the Switch User screen, inherits the right to use the Plex mobile apps for free from your Plex Pass and can be shared with by your Plex friends.

OttoKerner – Plex Ninja (Moderator)

Sounds not too bad, right? However, the managed user who is supposed to get a new full account probably has watched a few movies and tv shows on their own server. All that information would be “lost” by switching to using a freshly created Plex account. So, let’s try to transfer that information (Plex refers to it as the “viewstate”) to the new account.

Where does Plex store the viewstate?

Once again, the documentation is here to help. It contains a help article on how to move the viewstate between servers. To do so, you are asked to dump a certain table from an SQLite database first. You can then import the dumped data on the other/new server. The table in question is called metadata_item_settings.

Structure of the metadata_item_settings table structure

The second column is key: The account_id. Using that column, we can identify viewstate items for the old user and copy/move them to the new user. If we want to copy a user’s viewstate, we first SELECT all their items in the metadata_item_settings table. Then, we INSERT a new item with the target user’s account_id for each of the source user’s items. If, instead, we want to move a viewstate between users, we can simply UPDATE the source user’s items account_id to the account_id of the target user.

I have written a simple Python script to do just that. You can find the script and instruction on how to use it over on GitHub. Instructions currently only cover Windows and Linux, since I unfortunately do not have access to any of the various other devices able to run a Plex Media Server. If you have any issues with the script, please open an issue on GitHub. Also, please create a pull request if you can provide documentation on how to run the script on other platforms.