Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)
MIT License
1.54k stars 101 forks source link

Feature request: is it possible to sync the content from trakt to Plex even tho the content isn't available on plexserver #1142

Open krishne35 opened 1 year ago

krishne35 commented 1 year ago

Feature description

Use case

Basically I use plex_debrid service which scrapes content and skips if it's already watched so is it possible to copy the watched status of shows from trak to plex account even if it's show isn't available on server

Workarounds

Manually marking content as watched on plex

RileyXX commented 1 year ago

+1 for this feature

Reposting my comment from another post here:

So I know this script can import watch history from Trakt into Plex and vise versa. But from what I can tell it only imports watch history for items that are currently available to watch in my Plex library. The thing is I want to add ALL my watch history for items dating back several years into my Plex library, including items that are no longer available to watch in my Plex library. That way when I add old content to my Plex library the watch history is already available. Is this possible with this script?

I currently have the script set to auto run and import my watch history from plex to trakt. But I have trakt to plex disabled because sometimes things get marked as played by accident. And I have all my shows set to auto delete watched episodes. So in my case it's not worth it to auto import from trakt to plex since things will randomly get deleted on occasion. So I'm trying to find a way to import my old watch history all at once that way I don't need to have trakt to plex sync enabled.

glensc commented 1 year ago

I don't understand how can you mark an item watch state in plex that doesn't exist in plex? you need to have plex item to record state somewhere. the media files can of course be missing.

simonc56 commented 1 year ago

I self-assigned this. @glensc you are misunderstanding the feature request. Let me work it. I know how to do.

simonc56 commented 1 year ago

Needs to be implemented in PlexAPI first :

RileyXX commented 1 year ago

Not sure if this would be helpful but there is another script for importing/exporting plex data. I'm not sure if this script marks items as played that are not available in Plex but I'll just post it here maybe it will be useful as a point of reference. I don't think this script uses the PlexAPI. Maybe the solution would be to extra the plex database file, modify it, then merge it with the existing database file. Could be risky tho and could lead to a corrupted database file. https://github.com/Casvt/Plex-scripts/blob/main/multiple_servers/plex_exporter_importer.py

Which leads me to another idea I had. What if the script were to create dummy files for each item not currently in your Plex library. Say, a text file with some data renamed as a .mp4. Let the items import to Plex, apply the metadata for the item, mark the watched data for those files then delete them. I know it's a stretch but it could work. Sometimes a less conventional approach is the only way.

simonc56 commented 1 year ago

No, we'll do it properly with Plex API.

RileyXX commented 1 year ago

No, we'll do it properly with Plex API.

Fair enough. In the meantime if it's not possible with plex api I think I'll try putting together my own little script to see if I can accomplish this

glensc commented 1 year ago

No, we'll do it properly with Plex API.

Fair enough. In the meantime if it's not possible with plex api I think I'll try putting together my own little script to see if I can accomplish this

Why not put your efforts to the right place and submit a fix/improvement to PlexAPI?

RileyXX commented 1 year ago

Why not put your efforts to the right place and submit a fix/improvement to PlexAPI?

Yeah I can take a crack at it. But I am a bit of an amateur python coder. @Casvt might be able to help figure this out.

simonc56 commented 1 year ago

I'm currently working on it.

To sync :

watched status of :

and ratings of :

both ways between Trakt and Plex items not in the library.

The user is then supposed to enable the Sync Watch states and Ratings to use it at full potential.

Side effect : when disabling a trakt watched status or rating, it will be back at next sync because Plex keeps it in cloud database. Users may think it's a bug (see #1080).

RileyXX commented 1 year ago

I'm currently working on it.

Very cool thanks. Looking forward to seeing this in an official release.

Edit: Looks like it was recently merged in python-plexapi https://github.com/pkkid/python-plexapi/pull/1090. Should be possible now using PlexAPI.

jslpc commented 10 months ago

Any update on this? I was a bit surprised when sync only imported a handful of ratings, but I also just purged some of my Plex library of old watched media to save some storage, so it makes sense. I would love to have all of my ratings now that Plex just updated with the friends/social feature, even if the media is no longer in my library.

Otherwise, this tool was wildly easy to set up and configure and works perfectly; huge thank you to all of the devs and contributors to this project, I've been looking for something that could do this for awhile now. I'm excited to see what new features get added in the future.

glensc commented 10 months ago

@twolaw if you have unfinished work on this. perhaps push to some PR. a bit easier to continue one's work than start from scratch.

simonc56 commented 10 months ago

I need to find time to continue this. Here is bulk commit from May-3 : https://github.com/twolaw/PlexTraktSync/tree/plex-cloud-watched-status

glensc commented 9 months ago

@simonc56 please create a draft PR then.

simonc56 commented 8 months ago

Draft PR is here :