Plex Guide - Step by Step - Syncing Watched/Unwatched between different Servers (Including Remote)

Discussion in 'Media Guides' started by Nimrod, Apr 1, 2018.

  1. Nimrod

    Nimrod Exotic Vendor

    Jun 1, 2007
    Likes Received:
    London, United Kingdom
    Plex is an incredible media manager, the biggest feature I love so much is the fact it tracks your watched/unwatched status. Over years, this can really help you manage TV Shows and Movies and ensure you know where you are up to. However there comes a time where you need to re-build your Plex Server, deploy a new one or even switch from a local hosted one to a remote one (be it one in the Cloud or Dedicated Server, or a friends).

    Sadly in 2018, Plex still do not make it easy to 'transfer' your watched/unwatched status between servers.

    In my case, I had a Mac-Mini which has been running as a Plex Server for 6 years. As it aged, I increasingly started looking for alternatives. I eventually went down the route of Dedicated NAS Devices, which are excellent for Mass Storage and low power usage however what most models struggle with is Transcoding (the act where Plex transforms the media on your Server to a different format or lower bandwidth version for Mobile, Tablet or Remote users). The Solution was an Nvidia Shield TV on top of the NAS Box, this simple device which makes an awesome Netflix/Plex/Amazon/LiveTV streaming box can also run as a Plex Media Server and use its Nvidia Tegra GPU to transcode up to 3 full 1080p video files on the fly will being the size of an iPhone Plus. Therefore this became the new 'Plex Server' connected via network shares to my NAS Device. The downside however - 6 years of viewing history was lost. Now depending on your library size, you could do this manually... But thats a lot of effort with a lot of users. Therefore this is where the guide comes in.

    Just to add, this also works for concurrent Servers where you have two or more servers in active rotation, and wish to Sync between them.

    As a note, there is an alternative method which is to just install the Plugin which allows Username Roaming, however that involves
    A) Signing up for an account and syncing your watched content into a Public Site
    B) Requires installing Plugins on every Server (not so easy on Remote or Cloud Servers, or locked down devices like Plex for NAS Server or Plex for Android TV).
    C) The plugin is also not Plex approved so you have to manually install.
    If you would rather do that option, let me save you some time and link you straight to the Plugin:

    Now onto this Guide. This will be taken advantage of a lovely simple command-line tool called Plex-Sync by Jacobwgilles.
    With this tool, you can easily either one-time or via a Scheduled task, Sync Multiple Plex Servers.

    It supports :
    • Multiple Plex Servers (Sync as many as you want at the same time)
    • Unidirectional Syncing if you want to read from one, and write to another
    • Multiple Plex Logins if you have different logins
    • Dry Running - Allowing you to run it and view the results, but not commit them
    • Precise Mode - Using the Plex API, it will match TV Shows and Movies by their unique Plex GUID - slowly but ensures 100% match.

    You can download or read more about Plex-Sync on the Authors Github Page:

    Installing the Script:

    To install this plugin, you need to have NPM installed. NPM is Node Package Manager.

    For Windows Users, you need to:
    Download the Installer from the NodeJS Site at:
    For Mac Users:
    Install Homebrew:
    Install NPM via Homebrew by typing the following into Terminal: brew install node
    To install Plex-Sync, just type the following into Terminal:
    npm install -g plex-sync
    Once installed, the plugin is simple to use.

    Getting Ready:

    First and foremost though, you will need to get your Plex Token. To do this, I've already written a simple guide which you can view by clicking here:
    Plex Guide - Step by Step - Getting Plex Token

    You will also need to get 'Section IDs', these are Libaries in Plex. The reason for this, is you will be syncing from one Library to another. For example, if you have Movies and TV Shows on your Plex Server, each one of these is a separate 'section'. To get your section, it's as simple as signing into Plex Web and Browsing to the relevant Section and taking it from the URL:

    Plex Section.png

    In this example, the section for my TV Shows is 2.

    You need to do this on all the Plex Servers you have access to, recording each Section ID for each library you wish to sync.
    Your Plex Token however is unique to your Plex Login, and you will only need to pull it once (unless you have different logins for other Servers).

    Running the Script:

    I would recommend at this point, you take a look at examples and suggestions as provided by the author of the script which can be viewed on his Github Page:

    Scroll Down to the Paragraph 'Usage' for some examples.

    If its unavailable, I have a mirror of them which you can view below - but it may be out of date if the author pushes any updates:

    Plex Sync Usage.png Plex-Sync Usage Examples.png

    Once your set, just run the Command Line script and off you go! Here's it running on my Mac Syncing my Movies from one Server to my new server:

    Plex-Sync in Action.png

    PLEX_TOKEN=MYTOKENHERE MATCH_TYPE=precise plex-sync,r,w
    The command I used, was a read from one (old server) and a write to the new one. I did this by putting ,r on the reading server, and ,w on the to be written server. This was one of the usage examples the author provided. I also used the Match Type of Precise which meant it used the Plex ID's and it still completed in less than a minute.

    Other interesting things to keep in mind, you could easily schedule this via Windows Scheduled Tasks or CRON to run on a frequent bases. You could then for example, keep multiple Plex Servers in a constant state of Sync, including Friends Servers who have shared access to you (your token will be valid).

    If your doing a multiple user migration from one server to another. You can repeat this process over and over with each users Plex Tokens. I found it really easy to send them to my easy step by step guide (which helps the non-techies get their Plex Tokens):
    Plex Guide - Step by Step - Getting Plex Token
    Then once they provided it, I then ran the script to migrate their individual watched/unwatched status.

    I hope this guide helps, and if anyone has any cool ideas or needs any help, please reach out below in the post.

    Also a big credit for jacobwgillies for making this script and providing it freely.
    InsaneNutter likes this.
  2. Rhys Jones

    Rhys Jones New Member

    May 11, 2019
    Likes Received:
    Thanks for this guide. All goes well until I try and execute the code you suggest.
    PLEX_TOKEN=MYTOKENHERE MATCH_TYPE=precise plex-sync,r,w
    Obviously I substitute for my token and IP addresses but when executed on the command line I get a response:
    'PLEX_TOKEN' is not recognized as an internal or external command,
    I'm obviously doing something wrong here. Any thoughts?
  3. Nimrod

    Nimrod Exotic Vendor

    Jun 1, 2007
    Likes Received:
    London, United Kingdom
    The fact its looking for the command PLEX_TOKEN and not plex-sync tells me that the link isn't installed correctly.
    What happens if you just type plex-sync into Terminal?

    Are you using Mac? If Mac, do all the homebrew repair operations and updates.
    If Windows, it might be slightly different to invoke it.

Share This Page