Jump to content

Plex Migrations Scripts


Go to solution Solved by lionn1,

Recommended Posts

Posted

THANK YOU! are we allowed to slip you donations or something to keep this going?

Posted
On 9/19/2023 at 8:10 AM, auroraemby said:

THANK YOU! are we allowed to slip you donations or something to keep this going?

I second this! This has saved me an ungodly amount of hours, a donation to the project is the least I can do.

Posted

With the recent crackdown on paid plex shares you will see a wave of migration of users from plex to emby, and alot of fresh interest in this tool... 😉

Cr8iveLosr
Posted

Curious.

is it possible to use this script for plex skip intro and chapter thumbs to emby as well?

Thank you

CloudWing93
Posted
On 10/2/2023 at 11:42 AM, Cr8iveLosr said:

Curious.

is it possible to use this script for plex skip intro and chapter thumbs to emby as well?

Thank you

Looking at the docs for the plexapi python library we can get whether plex has generated intro markers but it doesn't return what those markers are so I don't think it is possible at this time.

  • Thanks 1
adminExitium
  • 2 weeks later...
Posted

Hi

Im new on emby - I alsp migrated from Plex. 

Then i saw that plex kill my acces, i ended up removing plex. Is it then still possible to Migrat the info?
im having some problems with identify tv show and episodes. 
 

Posted

Hi there,

I'm trying to migrate the watch history and I am currently experiencing the below error once starting:

 

Starting Movie Matching for user: Kickflix.
movie match success using imdb -- Constantine
movie match success using imdb -- Dungeons & Dragons: Honor Among Thieves
movie match success using imdb -- Enemy
movie match success using imdb -- A Grand Day Out
movie match success using imdb -- A Perfect World

Starting TV Series Matching for user: Kickflix.
Traceback (most recent call last):
  File "/opt/p2e/watch-history-migration.py", line 200, in <module>
    migrateShowsHistory(plexClientAdminUser, EMBY_ADMIN_USERNAME)
  File "/opt/p2e/watch-history-migration.py", line 190, in migrateShowsHistory
    if embyWatched == False:
       ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'embyWatched' where it is not associated with a value


Could you please share your insights and if there's something that has changed inside Emby? 

  • Solution
Posted
On 16/10/2023 at 13:23, lionn1 said:

Hi there,

I'm trying to migrate the watch history and I am currently experiencing the below error once starting:

 

Starting Movie Matching for user: Kickflix.
movie match success using imdb -- Constantine
movie match success using imdb -- Dungeons & Dragons: Honor Among Thieves
movie match success using imdb -- Enemy
movie match success using imdb -- A Grand Day Out
movie match success using imdb -- A Perfect World

Starting TV Series Matching for user: Kickflix.
Traceback (most recent call last):
  File "/opt/p2e/watch-history-migration.py", line 200, in <module>
    migrateShowsHistory(plexClientAdminUser, EMBY_ADMIN_USERNAME)
  File "/opt/p2e/watch-history-migration.py", line 190, in migrateShowsHistory
    if embyWatched == False:
       ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'embyWatched' where it is not associated with a value


Could you please share your insights and if there's something that has changed inside Emby? 

So going forward on this,

I have made a fork of the original and made some changes here.

https://gitlab.com/leeuw121/plex-to-emby-migration

*If anyone is going to use this, I am not aiming to make any public changes or fixes to this as this has mainly been to ensure that the scripts are working for myself, by no means would this mean I would be able to assist with many issues going forward at all. However if I do make any changes I will update the scripts accordingly.

Edits to the original:

I've split both migrations to be one for movies and one for tv. For myself, I have multiple TV libraries (Cartoons, TV, Anime etc) so to lighten the load on the script, I've split these apart so it's not constantly trying to migrate Movies every single time.

With this, the additions made to these are:

  • Watch data Scripts will run and output into "logs/[scriptname].log"
  • The initial coding has changed with small keyword changes to fit the changes in API's etc.

Learning from this I would ensure the below:

  • Ensure the Plex libraries are using either TVDB or TMDB instead of the Plex Series metadata, if you have to change this, I would highly recommend refreshing metadata. (Regarding the Hetzner difficulties, moving the plex server's full database into a local hosted service will assist in doing so)
  • Gaining the shared users' plex tokens has been difficult to do so without asking them to acquire this token for you. (I am looking into doing this via Plex User ID and just relying on the "Claimed Server Admin Token")
  • Some episodes in shows still have issues with matching. This can be a case where some words in episode names still aren't 100% accurate. EG: "Those Who Hunt: START" on Emby, and "Those Who Hunt: Start" on Plex. These won't migrate over until you change this on either Emby or Plex, however I would recommend changing this on Plex.

 

  • Thanks 1
  • 2 months later...
Posted

Hello,

I've used this script to migrate the admin user watched status and it worked great.  However I cannot figure out how to migrate the other shared users on Plex to a User on Emby.

Can someone please provide me with some help?

TIA

 

  • 3 weeks later...
Posted
2 hours ago, Adamaen said:

Hi,

Did you see my last post?

Yes, thank you.

  • 3 months later...
Posted

Hi!

Trying to use the script, but I'm getting the following error. Can someone help? Thanks :)

Getting Library Items. This can take a while.
Traceback (most recent call last):
  File "C:\Users\pierr\Downloads\plex-to-emby-migration-master (1)\plex-to-emby-migration-master\metadata-migration-tv.py", line 149, in <module>
    account = MyPlexAccount(PLEX_TOKEN)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pierr\AppData\Local\Programs\Python\Python312\Lib\site-packages\plexapi\myplex.py", line 125, in __init__
    data, initpath = self._signin(username, password, code, remember, timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pierr\AppData\Local\Programs\Python\Python312\Lib\site-packages\plexapi\myplex.py", line 138, in _signin
    data = self.query(self.SIGNIN, method=self._session.post, data=payload, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pierr\AppData\Local\Programs\Python\Python312\Lib\site-packages\plexapi\myplex.py", line 248, in query
    raise BadRequest(message)
plexapi.exceptions.BadRequest: (400) bad_request; https://plex.tv/api/v2/users/signin <?xml version="1.0" encoding="UTF-8"?> <errors>   <error code="1004" message="password is missing" status="400"/> </errors>

Posted

I was able to do it by using the username and password instead of the plex_token. Working now!

Posted

Everything worked well, but I'm wondering if the script could also sync the episode title cards/posters for series? I see that the get emby episodes function is there, so it would be feasible right? Thanks!

  • 9 months later...
Destrox
Posted (edited)
On 4/25/2024 at 4:39 PM, Snoak said:

I was able to do it by using the username and password instead of the plex_token. Working now!

How did you do that? Unable to sign in with Plex Token, someone know how?

Edited by Destrox
  • 2 months later...
thorinm
Posted
On 2/16/2025 at 7:15 PM, Destrox said:

How did you do that? Unable to sign in with Plex Token, someone know how?

I think I managed it, on line 160 of metadata-migration.py, replace PLEX_TOKEN in the parentheses with "USERNAME", "PASSWORD" so its like

account = MyPlexAccount("USERNAME", "PASSWORD")

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...