Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watchlist sync deletes items on one side, but it should ignore syncing that side instead #1872

Open
2 of 3 tasks
profucius opened this issue Mar 21, 2024 · 10 comments
Open
2 of 3 tasks

Comments

@profucius
Copy link

profucius commented Mar 21, 2024

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

When using PlexTraktSync sync command, the script fully syncs my watchlist on Plex to Trakt, and then deletes any Trakt watchlist that were not on Plex. I do not want anything deleted on Trakt, and that should not happen just because I have watchlist: false set in config.

Steps to reproduce the behavior

  1. Set config.yml
  2. Run plextraktsync sync
  3. Watch the command output as it syncs both watchlists.

Expected behavior

The script should sync any items in the Plex Watchlist to the Trakt Watchlist (watchlist: true), but then not sync the other way around at all (watchlist: false), especially not delete anything on Trakt Watchlist.

Config file contents

sync:
  plex_to_trakt:

    watchlist: true
  trakt_to_plex:

    watchlist: false

Install method

pipx

Version

0.29.8

Python Version

3.11.0

Plex Server Version

1.40.0.7998

Operating System and Version

Windows 11 22H2

@profucius profucius changed the title Watchlist is syncing both ways, but config is set for only one-way sync Watchlist sync deletes items on one side, but it should ignore syncing that side instead Mar 21, 2024
@glensc
Copy link
Collaborator

glensc commented Mar 22, 2024

This seems like a feature request. please edit your config here in the issue and keep only relevant options (watchlist) and remove empty prompts.

but what you ask seems needs another config option.

@profucius
Copy link
Author

profucius commented Mar 22, 2024

I have updated my original post. Below are more details about what I am requesting here.

If this is a feature request instead, then please consider this:

The current config terminology "watchlist" may need to be made more specific to ensure a clear understanding of the functionality. I look at the config file and see watchlist=true and I think "It will copy items in this direction only" whereas what it actually does is "It will copy items in this direction, AND delete to make a mirror in this direction, but only if they are both set to true", which is certainly confusing.

Compounding the confusion is that if both sides are set to watchlist=true, then it will mirror, which includes deleting from the source. But if only one side is true and one side is false, it will still copy to both sides, just not delete from one side. That does not make intuitive sense. If that is the intended feature, then perhaps the terminology in the config file should be changed from "watchlist" to "watchlist_mirror".

The functionality that I'm requesting is: If "watchlist" is set to true, it will copy in a direction but NOT mirror (aka, not delete from either side). And if set to false, then do not copy at all.


In plain language, I want to be able to copy Watchlist items from Plex to Trakt, but not copy Watchlist items from Trakt to Plex. The end result would be Plex always moves items into Trakt, so that Trakt is the kindof "master list", and so Trakt does NOT copy back over to Plex again.

The reason I am requesting for this is because I use another script that reads both my Plex and Trakt watchlists, and if they both have the same items (aka traditional sync), then it becomes a duplication nightmare. If I want to remove an item from the watchlist, I have to always remember to remove it from both Plex and Trakt watchlists, because otherwise PlexTraktSync will re-copy the deleted item from one back over to the other again.

An alternative to this idea would be for the script to include "differencing", aka to track when an item is removed from one watchlist and not copy it back to the other one. But that seems like even more work than what I am asking for, which is simply to have a line in the config file allow for copying one direction, but not the other, for the watchlists.

I hope this makes sense. I'm happy to rephrase or elaborate if needed.

@glensc
Copy link
Collaborator

glensc commented Mar 23, 2024

Current logic of watchlist sync is here:

  • def watchlist_sync_item(self, m: Media, dry_run=False):
    if m.plex is None:
    if self.config.update_plex_wl:
    self.logger.info(f"Skipping {m.title_link} from Trakt watchlist because not found in Plex Discover", extra={"markup": True})
    elif self.config.update_trakt_wl:
    self.logger.info(f"Removing {m.title_link} from Trakt watchlist", extra={"markup": True})
    if not dry_run:
    m.remove_from_trakt_watchlist()
    return
    if m in self.plex_wl:
    if m not in self.trakt_wl:
    if self.config.update_trakt_wl:
    self.logger.info(f"Adding {m.title_link} to Trakt watchlist", extra={"markup": True})
    if not dry_run:
    m.add_to_trakt_watchlist()
    else:
    self.logger.info(f"Removing {m.title_link} from Plex watchlist", extra={"markup": True})
    if not dry_run:
    m.remove_from_plex_watchlist()
    else:
    # Plex Online search is inaccurate, and it doesn't offer search by id.
    # Remove known match from trakt watchlist, so that the search would not be attempted.
    # Example, trakt id 187634 where title mismatches:
    # - "The Vortex": https://trakt.tv/movies/the-vortex-2012
    # - "Big Bad Bugs": https://app.plex.tv/desktop/#!/provider/tv.plex.provider.vod/details?key=%2Flibrary%2Fmetadata%2F5d776b1cad5437001f7936f4
    del self.trakt_wl[m]
    elif m in self.trakt_wl:
    if self.config.update_plex_wl:
    self.logger.info(f"Adding {m.title_link} to Plex watchlist", extra={"markup": True})
    if not dry_run:
    m.add_to_plex_watchlist()
    else:
    self.logger.info(f"Removing {m.title_link} from Trakt watchlist", extra={"markup": True})
    if not dry_run:
    m.remove_from_trakt_watchlist()

@glensc
Copy link
Collaborator

glensc commented Mar 23, 2024

Personally, I want this flow from playlist syncing:

  1. use plex watchlist, not plex playlist (watchlist_as_playlist: false)
  2. keep plex and trakt in sync (both watchlist: true)
  3. remove played items from the playlists (not yet supported)
  4. do not re-add items to playlist if they have been watched. not sure how to handle re-watches (not yet supported)

@JeanGionet
Copy link

JeanGionet commented Apr 23, 2024

if both plex and trakt are set to watchlist = true .... shouldn't the script MIRROR those watchlists to they match exactly? (same watchlist on both sides)

sync:
  plex_to_trakt:
    watchlist: true

  trakt_to_plex:
    watchlist: true

Right now I have both watchlists set to true. But, for whatever reason, if I delete something from my PLEX watchlist, it doesn't remove it from my Trakt watchlist. The script simply RE-ADDS what I just removed in PLEX since it's still listed on my Trakt watchlist. But, if I delete something from my TRAKT watchlist, the script will remove it from my PLEX watchlist.

@glensc
Copy link
Collaborator

glensc commented Apr 28, 2024

@JeanGionet please see already reported issues list from here:

there's no state stored for PlexTraktSync for it to know it if item was missing on one list, or you removed it.

@dimikal37
Copy link

Is there any update on this?

It would be nice if we could choose if we want to to append the content from a Plex watchlist to a Trakt watchlist and vice versa.
Rather than mirroring the entire content.

Currently it can be done only if you set both settings in True but in my case that it is not desired.

  plex_to_trakt:
    watchlist: true

  trakt_to_plex:
    watchlist: true

What I am looking is to have this option when you have one of the below settings:

  plex_to_trakt:
    watchlist: true

  trakt_to_plex:
    watchlist: false

OR

  plex_to_trakt:
    watchlist: false

  trakt_to_plex:
    watchlist: true

@dimikal37
Copy link

dimikal37 commented Jun 2, 2024

Based on the code posted above, it could be done by adding an extra condition before removing content.

 def watchlist_sync_item(self, m: Media, dry_run=False): 
     if m.plex is None: 
         if self.config.update_plex_wl: 
             self.logger.info(f"Skipping {m.title_link} from Trakt watchlist because not found in Plex Discover", extra={"markup": True}) 
         elif self.config.update_trakt_wl: 
             self.logger.info(f"Removing {m.title_link} from Trakt watchlist", extra={"markup": True}) 
             if not dry_run and not self.config.append_content: # append_content = new setting in config
                 m.remove_from_trakt_watchlist() 
         return 
     if m in self.plex_wl: 
         if m not in self.trakt_wl: 
             if self.config.update_trakt_wl: 
                 self.logger.info(f"Adding {m.title_link} to Trakt watchlist", extra={"markup": True}) 
                 if not dry_run: 
                     m.add_to_trakt_watchlist() 
             else: 
                 self.logger.info(f"Removing {m.title_link} from Plex watchlist", extra={"markup": True}) 
                 if not dry_run and not self.config.append_content: # append_content = new setting in config
                     m.remove_from_plex_watchlist() 
         else: 
             # Plex Online search is inaccurate, and it doesn't offer search by id. 
             # Remove known match from trakt watchlist, so that the search would not be attempted. 
             # Example, trakt id 187634 where title mismatches: 
             #  - "The Vortex": https://trakt.tv/movies/the-vortex-2012 
             #  - "Big Bad Bugs": https://app.plex.tv/desktop/#!/provider/tv.plex.provider.vod/details?key=%2Flibrary%2Fmetadata%2F5d776b1cad5437001f7936f4 
             del self.trakt_wl[m] 
     elif m in self.trakt_wl: 
         if self.config.update_plex_wl: 
             self.logger.info(f"Adding {m.title_link} to Plex watchlist", extra={"markup": True}) 
             if not dry_run: 
                 m.add_to_plex_watchlist() 
         else: 
             self.logger.info(f"Removing {m.title_link} from Trakt watchlist", extra={"markup": True}) 
             if not dry_run and not self.config.append_content: # append_content = new setting in config
                 m.remove_from_trakt_watchlist()

@glensc
Copy link
Collaborator

glensc commented Jun 7, 2024

please submit code changes as pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants