jacobwgillespie / plex-sync

:clapper: Command line utility for synchronizing Plex Media Server watched / seen status between multiple servers
https://www.npmjs.com/package/plex-sync
Other
305 stars 37 forks source link

Fix for recent agent update that broke TV Show sync #88

Open robdplatt opened 3 years ago

robdplatt commented 3 years ago

I noticed my TV Shows stopped syncing. Upon digging into the code and comparing it with the XML from the Plex API, I found that "year" was undefined in newer media. Looks like it was changed to "parentYear".

In the release code, I was able to fix this by changing

year = _ref3.year ;

to

year = _ref3.parentYear || _ref3.year ;

in node_modules\plex-sync\lib\plex.js.

x3m666 commented 2 years ago

Hi, I tried your fix but unfortunately it does not help. When I run the script on tv shows it always end with error: TypeError: Cannot read properties of undefined (reading 'Video') at ...plex.js:124:36 at Array.forEach (<anonymous>) at ...plex.js:123:23 at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)

robdplatt commented 2 years ago

@x3m666, It seems your issue was not related to the issue I was having. Which scanner and agent do you use for your tv library?

x3m666 commented 2 years ago

@robdplatt Default "Plex TV series" for both.

robdplatt commented 2 years ago

@x3m666 What does your script look like? Do you have the right library id's? Did this work previously and recently break?

x3m666 commented 2 years ago

@robdplatt It looks like plex-sync token@10.0.1.5/1,r token@10.0.1.10/3,w IDs are correct. This is actually first time using plex-sync. It worked for movies, but with TV shows have from beginning that problem. It starts good, i can see the read part finnish at 100% but when it should write status on new server, it fail.

robdplatt commented 2 years ago

This is what my batch file looks like. I allow r/w both directions. I haven't tested it exactly your way.

Both of my plex servers are up-to-date. One runs in windows, the other in an unraid container.

My TV Library is set up like yours.

I can't imagine why you are having different results.

echo Syncing Movies
cmd /c plex-sync.cmd token@192.168.1.4:32400/1 token@192.168.1.69:32400/1

echo Syncing TV
cmd /c plex-sync.cmd token@192.168.1.4:32400/3 token@192.168.1.69:32400/2 
x3m666 commented 2 years ago

I am trying to move from nvidia shield to windows box. Used only read because i dont know what it will do with my source and i dont want to lost my watched states if something goes wrong.

robdplatt commented 2 years ago

Back up your plex database. Do your testing. If you're not happy with the results, restore the database.

x3m666 commented 2 years ago

I really don't understand where the problem is. I tried sync my anime shows (which are tv shows) and there the sync worked correctly.

robdplatt commented 2 years ago

You might try creating another TV Shows library with a copy of one of the shows from your other library and seeing if sync will run that way.

x3m666 commented 2 years ago

Tried it (only on part of my library because is huge) and its working. But since it doesn't work with my old library all I can do now is to manually mark my played tv shows. Nonetheless, thank you for your help.

robdplatt commented 2 years ago

Why not point your new library to the same path as your old library, let it rescan, then go from there? Won’t that save your watch status?

[https://www.efrecovery.net/images/EFR_Ellipse_300x200_Transparent.png] Rob Platt Chief Technology Officer, Security Officer EF Recovery LLC PO Box 590, Gig Harbor, WA 98335 Office: 253-853-1316 Email: @.**@.> Web: www.efrecovery.comhttps://www.efrecovery.com

Follow us on social media: [https://www.efrecovery.net/images/image.aspx?rsid=b1a1fcc0-1709-4499-a952-02890d3ba944&maxwidth=32]https://www.facebook.com/EF-Recovery-LLC-108248994818615/ [https://www.efrecovery.net/images/image.aspx?rsid=99540b2a-36bc-4940-bc3a-d38d56bb2d22&maxwidth=32] https://twitter.com/efrecovery [https://www.efrecovery.net/images/image.aspx?rsid=f2a17052-f9e1-4134-ab6c-e16af0bdb947&maxwidth=32] https://www.linkedin.com/company/ef-recovery [https://www.efrecovery.net/images/image.aspx?rsid=ff92c984-c335-4c8d-988e-20273439feac&maxwidth=32] https://www.instagram.com/efrecoveryllc/ CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential, proprietary, and/or privileged information protected by law. If you are not the intended recipient, you may not use, copy, or distribute this e-mail message or its attachments. If you believe you have received this e-mail message in error, please contact the sender by reply e-mail and telephone immediately and destroy all copies of the original message.

From: x3m666 @. Sent: Monday, January 24, 2022 10:01 AM To: jacobwgillespie/plex-sync @.> Cc: Rob Platt @.>; Mention @.> Subject: Re: [jacobwgillespie/plex-sync] Fix for recent agent update that broke TV Show sync (#88)

Tried it (only on part of my library because is huge) and its working. But since it doesn't work with my old library all I can do now is to manually mark my played tv shows. Nonetheless, thank you for your help.

— Reply to this email directly, view it on GitHubhttps://github.com/jacobwgillespie/plex-sync/issues/88#issuecomment-1020384015, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADHGD35IDFLFIH573MYHXALUXWHXLANCNFSM5DE7XHQQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

x3m666 commented 2 years ago

Watch state is not saved in the library, but in the DB. Otherwise there would be no problem, since I'm moving only the server part, not the data itself.

robdplatt commented 2 years ago

There's a free tract.tv sync script you could try running. Maybe it would help you get the sync status into the new library? I was looking into it, but haven't used it yet.

Also, you might be able to get the new library up and running, then go into the database and change the library id to the new id?

x3m666 commented 2 years ago

I was also looking on that tract plugin, but as far as i know the plugins support for plex is poor to almost non-existent and since my original plex server is served by Nvidia shield it complicate things even more. Therefore I also didn't go to DB migration/synchronization tools. I like this plex-sync tool because it works without any complicated workarounds.

robdplatt commented 2 years ago

I would probably look at editing the database myself. If the new library works, point it to your current media folder. Now you have two tv librarys, one with no watch status. I would shut down plex, and open the database with any sqlite editor, and see if you can identify the library id with the watch status. Try updating it to the new library id. Start plex back up and see if that worked. Be sure to backup your database.