Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: check for duplicates before marking as watched

rala72 opened this issue · comments

commented

Feature description

For recently watched episodes and movies check if Trakt has a entry already recently added (via scrobbler for example).
If yes, don't report it as watched to avoid duplicates.

Use case

I have the scrobbler and sync enabled for two way sync & as fall back.
But therefore both report an entry as watched, my history always has duplication.

Workarounds

Check the history regularly and delete an entry.
Have to figure out which is the correct one though if you care about it.

Plan to implement

Not yet. :(

if entry is submitted by watch, then that's intended behavior to have rewatches recorded. if sync also submits a play that sounds like a bug. try runinng sync with --no-cache and/or check debug logs for trakt calls.

commented

based on logs it looks like watch is active and I'm not sure I enabled it ...

2024-03-03 22:19:36,253 INFO[PlexTraktSync.WatchStateUpdater]:on_activity: tmdb:1184326:Episode:12441:Faking-It-s03e06: Collected: True, Watched: [Plex: False, Trakt: False]
2024-03-03 22:19:46,228 INFO[PlexTraktSync.WatchStateUpdater]:on_play: Episode:12436:Faking-It-s03e01: 0.004601%, State: playing, Played: False, LastViewed: None
2024-03-03 22:19:54,798 INFO[PlexTraktSync.WatchStateUpdater]:on_play: Episode:12436:Faking-It-s03e01: 0.753620%, State: stopped, Played: False, LastViewed: None

How can I disable it?
I only want to have the default cron job running.
I'm using https://github.com/linuxserver-labs/docker-plextraktsync on my Synology NAS.
At least I want to use the native Plex scrobbler.

Also wondering why I sometimes have multiple entries at the same (wrong) time of different episodes.
Looks more like a sync is causing it...?
Example of what I mean from my memories:

12:00 s1e1
12:10 s1e1
12:10 s1e2
12:20 s1e2

I'm using linuxserver-labs/docker-plextraktsync ( 27 minutes ago) on my Synology NAS.

you have to ask their support then.

commented

I created an issue in their side.
But as I noted in my previous comment, it looks for me that the sync is causing it.
Because the logs are full of

<plextraktsync.queue.TraktScrobbleWorker.TraktScrobbleWorker object at
ERROR Got exception while working on
Ox7f4b022cd890>: Conflict - resource already created

I would assume, that the attempt to log the watch state fails.
The duplicate entry is always appearing a bit later after the correct time.* (edit: I think it's actually the other way around - see next comment)

Can you please have a look at the sync command or tell me how I can support you there?

commented

I guess the duplicated entry of the second one comes from the sync threshold: like it passed the percentage (like 80%) of the episode and is counted as watched, even though it's still running.

This is not necessarily wrong, but in my opinion the next sync should then check the previous created entries and check for created duplicates around the last entry.
Like it's not possible to watch the same movie/episode twice during 30min (or whatever frame you think suits).
Not meaning to check for duplicates in general - I still want that rewatches work!

I guess the duplicated entry of the second one comes from the sync threshold: like it passed the percentage (like 80%) of the episode and is counted as watched, even though it's still running.

this is not true. while both plex and trakt.tv check this threshold, they don't mark things played when the threshold has passed. they also require scrobbling to be stopped.

and this app doesn't mark played when you stop media in watch mode, it's trakt.tv that does it, it only sends stop play or pause play:

  • def stop(self, progress: float):
    if progress >= self.threshold:
    self.logger.debug(f"stop({self.scrobbler.media}): {progress}")
    self.queue.scrobble_stop((self.scrobbler, progress))
    else:
    self.logger.debug(f"pause({self.scrobbler.media}): {progress}")
    self.queue.scrobble_pause((self.scrobbler, progress))

<plextraktsync.queue.TraktScrobbleWorker.TraktScrobbleWorker object at
ERROR Got exception while working on
Ox7f4b022cd890>: Conflict - resource already created

this is new info. can you provide full details of the error and preceding entries, and is there debug trace? enable debug logging first.

any in any case, figure out what makes unwanted mark as played. enable debug logging and find related trakt.tv requests from the log.

as for linuxserver-labs images, why not just use official image form this project?

commented

Good to know, then I'll enable DEBUG logging as you suggested and see what I get.

as for linuxserver-labs images, why not just use official image form this project?

I used an older version once, but therefore it didn't keep running after the sync was done / didn't handle the cron job stuff itself, I stopped.
I know you can make cron jobs in DSM itself, but after every stop Synology emailed me for an unexpected stop and there is no option to disable it.
So I switched.

I think I tried the new version yet with the scheduler once, but I wasn't able to get it to work yet.
The setup guide wasn't really helpful, but I'll try it again.

Edits:
At the moment I get: Error: Program requested terminal, No terminal is connected: EOF when reading a line
I can start via SSH in terminal interactively, but then the project setup I have configured via compose doesn't apply....
Is there a way to start this container and keep it running, so I can connect via SSH?
I tried it now via docker-compose run via ssh and was able to proceed through the process...
But the config files were not saved in the configured folder and I got the message Error running sync command: Server with name SERVERNAME is not defined...
I noticed now, that not doing it via DSM directly causes creating separate images with probably different config.
So no clue what's going on here and I'll stop trying it for now.

commented

Log entry from similar error as above (excepert incl. surroundings):

2024-03-06 22:55:12,078 DEBUG[plexapi]:Alert: type size PlaySessionStateNotification
2024-03-06 22:55:12,078 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'playing', 'size': 1, 'PlaySessionStateNotification': [{'sessionKey': '97', 'clientIdentifier': '3fbf9586d81e1a61-com-plexapp-android', 'guid': 'plex://episode/5de8ee5d18b6d6001db4ac66', 'ratingKey': '6984', 'url': '', 'key': '/library/metadata/6984', 'viewOffset': 2432248, 'playQueueItemID': 16360, 'playQueueID': 496, 'state': 'stopped'}]}
2024-03-06 22:55:12,078 DEBUG[trakt.core]:get: https://api.trakt.tv/search/tmdb/1460085?type=episode
2024-03-06 22:55:12,078 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/search/tmdb/1460085?type=episode
2024-03-06 22:55:12,079 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:12,080 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
2024-03-06 22:55:12,081 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1)
2024-03-06 22:55:12,081 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/search/tmdb/1460085?type=episode): <CachedResponse [200]: created: 2024-03-06 22:12:53 CET, expires: 2024-03-07 06:12:53 CET (fresh), size: 322 bytes, request: GET https://api.trakt.tv/search/tmdb/1460085?type=episode>
2024-03-06 22:55:12,082 DEBUG[PlexTraktSync]:Resolved <PlexGuid:tmdb://1460085> of <tmdb:1460085:Episode:6984:iZombie-s04e06> to <tmdb:1460085:Episode:6984:iZombie-s04e06>
2024-03-06 22:55:12,082 INFO[PlexTraktSync.WatchStateUpdater]:on_play: <Episode:6984:iZombie-s04e06>: 99.889279%, State: stopped, Played: False, LastViewed: None
2024-03-06 22:55:12,084 DEBUG[PlexTraktSync.ScrobblerProxy]:stop(<TVEpisode>: iZombie S4E6 My Really Fair Lady): 99.88927876780738
2024-03-06 22:55:12,084 DEBUG[PlexTraktSync.WatchStateUpdater]:Scrobbled: None
2024-03-06 22:55:12,477 DEBUG[plexapi]:Alert: type size PlaySessionStateNotification
2024-03-06 22:55:12,477 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'playing', 'size': 1, 'PlaySessionStateNotification': [{'sessionKey': '98', 'clientIdentifier': '3fbf9586d81e1a61-com-plexapp-android', 'guid': 'plex://episode/5de8ee5e18b6d6001db4ac6a', 'ratingKey': '6985', 'url': '', 'key': '/library/metadata/6985', 'viewOffset': 2432479, 'playQueueItemID': 16361, 'playQueueID': 496, 'state': 'playing'}]}
2024-03-06 22:55:12,477 DEBUG[plexapi]:GET https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/status/sessions
2024-03-06 22:55:12,479 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:12,479 DEBUG[requests_cache.policy.expiration]:URL https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/status/sessions matched pattern "*/status/sessions": 3674576450094852
2024-03-06 22:55:12,479 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled by expiration
2024-03-06 22:55:12,479 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=3674576450094852, send_request=True, skip_read=True)
2024-03-06 22:55:12,480 DEBUG[urllib3.connectionpool]:Resetting dropped connection: 192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct
2024-03-06 22:55:12,583 DEBUG[urllib3.connectionpool]:https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400 "GET /status/sessions HTTP/1.1" 200 2787
2024-03-06 22:55:12,584 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_cache=True)
2024-03-06 22:55:12,584 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled by expiration
2024-03-06 22:55:12,584 DEBUG[requests_cache.session]:Skipping cache write for URL: https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/status/sessions
2024-03-06 22:55:12,592 DEBUG[plexapi]:GET https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985
2024-03-06 22:55:12,594 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:12,594 DEBUG[requests_cache.policy.expiration]:URL https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985 matched pattern "*/library/metadata/*": 3674576450094852
2024-03-06 22:55:12,594 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled by expiration
2024-03-06 22:55:12,594 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=3674576450094852, send_request=True, skip_read=True)
2024-03-06 22:55:12,603 DEBUG[urllib3.connectionpool]:https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400 "GET /library/metadata/6985 HTTP/1.1" 200 2667
2024-03-06 22:55:12,604 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_cache=True)
2024-03-06 22:55:12,604 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled by expiration
2024-03-06 22:55:12,604 DEBUG[requests_cache.session]:Skipping cache write for URL: https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985
2024-03-06 22:55:12,612 DEBUG[trakt.core]:get: https://api.trakt.tv/search/tmdb/1462753?type=episode
2024-03-06 22:55:12,612 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/search/tmdb/1462753?type=episode
2024-03-06 22:55:12,613 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:12,613 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
2024-03-06 22:55:12,614 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True)
2024-03-06 22:55:13,058 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "GET /search/tmdb/1462753?type=episode HTTP/1.1" 200 None
2024-03-06 22:55:13,059 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(expires='Thu, 07 Mar 2024 05:55:12 GMT', max_age=28800, etag='W/"2c963a8d4560c47525809d896cec703e"')
2024-03-06 22:55:13,059 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: Passed
2024-03-06 22:55:13,874 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/search/tmdb/1462753?type=episode): <Response [200]>
2024-03-06 22:55:13,875 DEBUG[PlexTraktSync]:Resolved <PlexGuid:tmdb://1462753> of <tmdb:1462753:Episode:6985:iZombie-s04e07> to <tmdb:1462753:Episode:6985:iZombie-s04e07>
2024-03-06 22:55:13,875 DEBUG[trakt.core]:get: https://api.trakt.tv/search/tmdb/60866?type=show
2024-03-06 22:55:13,875 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/search/tmdb/60866?type=show
2024-03-06 22:55:13,876 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:13,876 DEBUG[requests_cache.policy.expiration]:URL https://api.trakt.tv/search/tmdb/60866?type=show matched pattern "api.trakt.tv/search/tmdb/*?type=show": 1 day, 0:00:00
2024-03-06 22:55:13,877 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
2024-03-06 22:55:13,878 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=datetime.timedelta(days=1))
2024-03-06 22:55:13,878 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/search/tmdb/60866?type=show): <CachedResponse [200]: created: 2024-03-06 22:12:54 CET, expires: 2024-03-07 06:12:54 CET (fresh), size: 168 bytes, request: GET https://api.trakt.tv/search/tmdb/60866?type=show>
2024-03-06 22:55:13,878 DEBUG[PlexTraktSync]:Resolved <PlexGuid:tmdb://60866> of <tmdb:60866:Show:6963:iZombie> to <tmdb:60866:Show:6963:iZombie>
2024-03-06 22:55:13,878 DEBUG[plexapi]:Reloading Episode 'Im Netz des Playboys' for attr 'lastViewedAt'
2024-03-06 22:55:13,878 DEBUG[plexapi]:GET https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985?checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExternalMedia=1&includeExtras=1&includeFields=thumbBlurHash%2CartBlurHash&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1
2024-03-06 22:55:13,880 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:13,880 DEBUG[requests_cache.policy.expiration]:URL https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985?checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExternalMedia=1&includeExtras=1&includeFields=thumbBlurHash%2CartBlurHash&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1 matched pattern "*/library/metadata/*?*include*": 3674576450094852
2024-03-06 22:55:13,881 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled by expiration
2024-03-06 22:55:13,881 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=3674576450094852, send_request=True, skip_read=True)
2024-03-06 22:55:13,896 DEBUG[urllib3.connectionpool]:https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400 "GET /library/metadata/6985?checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExternalMedia=1&includeExtras=1&includeFields=thumbBlurHash%2CartBlurHash&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1 HTTP/1.1" 200 2879
2024-03-06 22:55:13,897 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_cache=True)
2024-03-06 22:55:13,897 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled by expiration
2024-03-06 22:55:13,897 DEBUG[requests_cache.session]:Skipping cache write for URL: https://192-168-1-10.2b71b2b8fae940f5966886577aec2a17.plex.direct:32400/library/metadata/6985?checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExternalMedia=1&includeExtras=1&includeFields=thumbBlurHash%2CartBlurHash&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1
2024-03-06 22:55:13,905 INFO[PlexTraktSync.WatchStateUpdater]:on_play: <Episode:6985:iZombie-s04e07>: 99.883014%, State: playing, Played: False, LastViewed: None
2024-03-06 22:55:13,907 DEBUG[PlexTraktSync.ScrobblerProxy]:update(<TVEpisode>: iZombie S4E7 Don't Hate the Player, Hate the Brain): 99.8830137049301
2024-03-06 22:55:13,907 DEBUG[PlexTraktSync.WatchStateUpdater]:Scrobbled: None
2024-03-06 22:55:13,908 DEBUG[plexapi]:Alert: type size PlaySessionStateNotification
2024-03-06 22:55:13,908 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'playing', 'size': 1, 'PlaySessionStateNotification': [{'sessionKey': '98', 'clientIdentifier': '3fbf9586d81e1a61-com-plexapp-android', 'guid': 'plex://episode/5de8ee5e18b6d6001db4ac6a', 'ratingKey': '6985', 'url': '', 'key': '/library/metadata/6985', 'viewOffset': 2432479, 'playQueueItemID': 16361, 'playQueueID': 496, 'state': 'buffering'}]}
2024-03-06 22:55:16,908 DEBUG[trakt.core]:post: https://api.trakt.tv/scrobble/start
2024-03-06 22:55:16,908 DEBUG[trakt.core]:method, url :: post, https://api.trakt.tv/scrobble/start
2024-03-06 22:55:16,910 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:16,910 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-03-06 22:55:16,910 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-03-06 22:55:17,431 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /scrobble/start HTTP/1.1" 201 None
2024-03-06 22:55:17,431 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(max_age=0, must_revalidate=True, etag='W/"839ab141b33ae8a572fa55c64807cf3b"')
2024-03-06 22:55:17,432 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method, disabled status
2024-03-06 22:55:17,432 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/scrobble/start
2024-03-06 22:55:17,432 DEBUG[trakt.core]:RESPONSE [post] (https://api.trakt.tv/scrobble/start): <Response [201]>
2024-03-06 22:55:17,432 DEBUG[PlexTraktSync.TraktScrobbleWorker]:Submitted scrobble_update: [{'id': 0, 'action': 'start', 'progress': 99.8830137049301, 'sharing': {'facebook': False, 'twitter': False, 'mastodon': False, 'tumblr': False}, 'episode': {'season': 4, 'number': 7, 'title': "Don't Hate the Player, Hate the Brain", 'ids': {'trakt': 2731137, 'tvdb': 6317440, 'imdb': 'tt7538714', 'tmdb': 1462753, 'tvrage': None}}, 'show': {'title': 'iZombie', 'year': 2015, 'ids': {'trakt': 77686, 'slug': 'izombie', 'tvdb': 281470, 'imdb': 'tt3501584', 'tmdb': 60866, 'tvrage': None}}}]
2024-03-06 22:55:17,432 DEBUG[PlexTraktSync.Timer]:Sleeping for 0.576 seconds
2024-03-06 22:55:18,008 DEBUG[trakt.core]:post: https://api.trakt.tv/scrobble/stop
2024-03-06 22:55:18,008 DEBUG[trakt.core]:method, url :: post, https://api.trakt.tv/scrobble/stop
2024-03-06 22:55:18,010 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:18,010 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: disabled method
2024-03-06 22:55:18,010 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1, send_request=True, skip_read=True)
2024-03-06 22:55:18,424 DEBUG[urllib3.connectionpool]:https://api.trakt.tv:443 "POST /scrobble/stop HTTP/1.1" 409 None
2024-03-06 22:55:18,425 DEBUG[requests_cache.policy.actions]:Cache directives from response headers: CacheDirectives(no_cache=True)
2024-03-06 22:55:18,426 DEBUG[requests_cache.policy.actions]:Pre-write cache checks: disabled method, disabled status
2024-03-06 22:55:18,426 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api.trakt.tv/scrobble/stop
2024-03-06 22:55:18,426 DEBUG[trakt.core]:RESPONSE [post] (https://api.trakt.tv/scrobble/stop): <Response [409]>
2024-03-06 22:55:18,426 ERROR[PlexTraktSync.BackgroundTask]:Got exception while working on <plextraktsync.queue.TraktScrobbleWorker.TraktScrobbleWorker object at 0x7f5ac324af50>: Conflict - resource already created
2024-03-06 22:55:23,054 DEBUG[plexapi]:Alert: type size PlaySessionStateNotification
2024-03-06 22:55:23,054 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'playing', 'size': 1, 'PlaySessionStateNotification': [{'sessionKey': '98', 'clientIdentifier': '3fbf9586d81e1a61-com-plexapp-android', 'guid': 'plex://episode/5de8ee5e18b6d6001db4ac6a', 'ratingKey': '6985', 'url': '', 'key': '/library/metadata/6985', 'viewOffset': 8508, 'playQueueItemID': 16361, 'playQueueID': 496, 'state': 'playing'}]}
2024-03-06 22:55:23,054 DEBUG[trakt.core]:get: https://api.trakt.tv/search/tmdb/1462753?type=episode
2024-03-06 22:55:23,054 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/search/tmdb/1462753?type=episode
2024-03-06 22:55:23,056 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:23,056 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
2024-03-06 22:55:23,057 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=-1)
2024-03-06 22:55:23,058 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/search/tmdb/1462753?type=episode): <CachedResponse [200]: created: 2024-03-06 22:55:13 CET, expires: 2024-03-07 06:55:13 CET (fresh), size: 340 bytes, request: GET https://api.trakt.tv/search/tmdb/1462753?type=episode>
2024-03-06 22:55:23,058 DEBUG[PlexTraktSync]:Resolved <PlexGuid:tmdb://1462753> of <tmdb:1462753:Episode:6985:iZombie-s04e07> to <tmdb:1462753:Episode:6985:iZombie-s04e07>
2024-03-06 22:55:23,058 DEBUG[trakt.core]:get: https://api.trakt.tv/search/tmdb/60866?type=show
2024-03-06 22:55:23,058 DEBUG[trakt.core]:method, url :: get, https://api.trakt.tv/search/tmdb/60866?type=show
2024-03-06 22:55:23,059 DEBUG[requests_cache.policy.actions]:Cache directives from request headers: CacheDirectives()
2024-03-06 22:55:23,059 DEBUG[requests_cache.policy.expiration]:URL https://api.trakt.tv/search/tmdb/60866?type=show matched pattern "api.trakt.tv/search/tmdb/*?type=show": 1 day, 0:00:00
2024-03-06 22:55:23,059 DEBUG[requests_cache.policy.actions]:Pre-read cache checks: Passed
2024-03-06 22:55:23,060 DEBUG[requests_cache.policy.actions]:Post-read cache actions: CacheActions(expire_after=datetime.timedelta(days=1))
2024-03-06 22:55:23,061 DEBUG[trakt.core]:RESPONSE [get] (https://api.trakt.tv/search/tmdb/60866?type=show): <CachedResponse [200]: created: 2024-03-06 22:12:54 CET, expires: 2024-03-07 06:12:54 CET (fresh), size: 168 bytes, request: GET https://api.trakt.tv/search/tmdb/60866?type=show>
2024-03-06 22:55:23,061 DEBUG[PlexTraktSync]:Resolved <PlexGuid:tmdb://60866> of <tmdb:60866:Show:6963:iZombie> to <tmdb:60866:Show:6963:iZombie>
2024-03-06 22:55:23,061 INFO[PlexTraktSync.WatchStateUpdater]:on_play: <Episode:6985:iZombie-s04e07>: 0.349357%, State: playing, Played: False, LastViewed: None
2024-03-06 22:55:23,063 DEBUG[PlexTraktSync.ScrobblerProxy]:update(<TVEpisode>: iZombie S4E7 Don't Hate the Player, Hate the Brain): 0.3493574582150741
2024-03-06 22:55:23,063 DEBUG[PlexTraktSync.WatchStateUpdater]:Scrobbled: None

Regarding the duplicate entry...
I haven't find a 100% proof in the logs, that these caused the second history entry, BUT I found something suspicous:
The actual history entry of iZombie s3x6 is (as you see above) at 22:51 (I guess there I reached the threshhold).
But the duplicate got created at 23:33 - and exactly at that time a sync happend.
Here an excerpt:

2024-03-06 23:33:10,441 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,441 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}'}]}
2024-03-06 23:33:10,442 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,442 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}/Season 2'}]}
2024-03-06 23:33:10,442 DEBUG[plexapi]:Alert: type size ActivityNotification
2024-03-06 23:33:10,442 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'activity', 'size': 1, 'ActivityNotification': [{'event': 'updated', 'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'Activity': {'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'type': 'library.update.section', 'cancellable': False, 'userID': 1, 'title': 'Scanning Serien', 'subtitle': 'iZombie (2015) {tmdb-60866} - Season 2', 'progress': 23, 'Context': {'librarySectionID': '2'}}}]}
2024-03-06 23:33:10,442 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,442 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}/Season 5'}]}
2024-03-06 23:33:10,445 DEBUG[plexapi]:Alert: type size ActivityNotification
2024-03-06 23:33:10,445 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'activity', 'size': 1, 'ActivityNotification': [{'event': 'updated', 'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'Activity': {'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'type': 'library.update.section', 'cancellable': False, 'userID': 1, 'title': 'Scanning Serien', 'subtitle': 'iZombie (2015) {tmdb-60866} - Season 5', 'progress': 24, 'Context': {'librarySectionID': '2'}}}]}
2024-03-06 23:33:10,445 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,445 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}/Season 4'}]}
2024-03-06 23:33:10,445 DEBUG[plexapi]:Alert: type size ActivityNotification
2024-03-06 23:33:10,445 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'activity', 'size': 1, 'ActivityNotification': [{'event': 'updated', 'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'Activity': {'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'type': 'library.update.section', 'cancellable': False, 'userID': 1, 'title': 'Scanning Serien', 'subtitle': 'iZombie (2015) {tmdb-60866} - Season 4', 'progress': 24, 'Context': {'librarySectionID': '2'}}}]}
2024-03-06 23:33:10,446 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,446 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}/Season 3'}]}
2024-03-06 23:33:10,446 DEBUG[plexapi]:Alert: type size ActivityNotification
2024-03-06 23:33:10,446 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'activity', 'size': 1, 'ActivityNotification': [{'event': 'updated', 'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'Activity': {'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'type': 'library.update.section', 'cancellable': False, 'userID': 1, 'title': 'Scanning Serien', 'subtitle': 'iZombie (2015) {tmdb-60866} - Season 3', 'progress': 24, 'Context': {'librarySectionID': '2'}}}]}
2024-03-06 23:33:10,455 DEBUG[plexapi]:Alert: type size ProgressNotification
2024-03-06 23:33:10,455 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'progress', 'size': 1, 'ProgressNotification': [{'message': 'Scanning iZombie (2015) {tmdb-60866}/Season 1'}]}
2024-03-06 23:33:10,456 DEBUG[plexapi]:Alert: type size ActivityNotification
2024-03-06 23:33:10,456 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'activity', 'size': 1, 'ActivityNotification': [{'event': 'updated', 'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'Activity': {'uuid': 'a1ea0b0a-e677-4c4e-b3ec-02ee989f7355', 'type': 'library.update.section', 'cancellable': False, 'userID': 1, 'title': 'Scanning Serien', 'subtitle': 'iZombie (2015) {tmdb-60866} - Season 1', 'progress': 25, 'Context': {'librarySectionID': '2'}}}]}
2024-03-06 23:33:10,456 DEBUG[plexapi]:Alert: type size ProgressNotification
commented

@glensc any updates on this or can I provide more infos?

2024-03-06 22:55:18,424 DEBUG[urllib3.connectionpool]:[https://api.trakt.tv:443](https://api.trakt.tv/) "POST /scrobble/stop HTTP/1.1" 409 None

this might be your problem. this was fixed in #1882

commented

Thank you for the notice, that there is a new version which fixed this issue.
I updated, and now I'm getting this error - might be a linuxserver issue though:

INFO     Starting AlertListener:
         wss://<hidden>.plex.direct:32400/:
         /websockets/notifications?X-Plex-Token=<hidden>
INFO     Server connected: <hidden>
ERROR    AlertListener Error: [Errno -3] Try again
ERROR    [Errno -3] Try again - goodbye
ERROR    Server closed connection
ERROR    Listener finished. Restarting in 15 seconds
commented

At the moment I get: Error: Program requested terminal, No terminal is connected: EOF when reading a line I can start via SSH in terminal interactively, but then the project setup I have configured via compose doesn't apply.... Is there a way to start this container and keep it running, so I can connect via SSH? I tried it now via docker-compose run via ssh and was able to proceed through the process... But the config files were not saved in the configured folder and I got the message Error running sync command: Server with name SERVERNAME is not defined... I noticed now, that not doing it via DSM directly causes creating separate images with probably different config. So no clue what's going on here and I'll stop trying it for now.

Is there any way to get around this?
Would be awesome if I could use the official image with the periodic sync.

one issue one problem please. seems the original bug reported is solved. closing

however, Program requested terminal means you started container without terminal, you need -t flag for docker run usually combined with -i as well. and why I wants terminal is probably you have not configured plex and trakt access. plextraktsync trakt-login and plextraktsync plex-login to setup them. or copy the config files from previous installation.

commented

one issue one problem please. seems the original bug reported is solved. closing

The original topic was a feature request, where I'm not sure if it has been implemented yet, but fine.
Opened #1890 for the follow up bug.

however, Program requested terminal means you started container without terminal, you need -t flag for docker run usually combined with -i as well. and why I wants terminal is probably you have not configured plex and trakt access. plextraktsync trakt-login and plextraktsync plex-login to setup them. or copy the config files from previous installation.

I don't think this is possible on my NAS, but I'll check it out later if there is any hacky way to do it.

You requested check for duplicates (it won't be implemented like you ask), but apparently it was just a bug that 409 errors were retried and some of them actually succeeded:

commented

It's not possible to start it with a terminal in the UI and if I try it via shell it stops automatically as well.
If I create it via a shell it creates a separate instance which is not possible to use the way Synology wants it...
I also haven't found anything useful how I can do it differently yet.

or copy the config files from the previous installation.

can't help you here, don't have any synology and you haven't shared any details either what you've done. did you even add volume to share the config files? no idea.