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.55k stars 101 forks source link

[watch] ERROR 'N' on Stop #1079

Closed solid-pixel closed 1 year ago

solid-pixel commented 1 year ago

Confirmation

The problem

Hello, well first of all THANK YOU. This plugin is SO well made, the CLI interface and decorations during sync and set up blew me away ❤️

whenever an episode either ends or I hit Stop, I get an error in watch like: ERROR[PlexTraktSync.EventDispatcher]:'13'

I think it started from 1 and it keeps increasing the number every time the episode stops. It's a bit hard to figure this one out given the lack of info in the error.

It still seems to be correctly sending info to Trakt, I'm just mostly annoyed by the error showing up in my discord logs parser.

image image

Error trace / logs

2022-10-01 15:21:01,691 DEBUG[trakt.core]:method, url :: post, https://api-v2launch.trakt.tv/scrobble/start
2022-10-01 15:21:01,692 DEBUG[requests_cache.cache_control]:Cache directives from request headers: {}
2022-10-01 15:21:02,191 DEBUG[urllib3.connectionpool]:https://api-v2launch.trakt.tv:443 "POST /scrobble/start HTTP/1.1" 201 None
2022-10-01 15:21:02,192 DEBUG[requests_cache.session]:Pre-cache checks for response from https://api-v2launch.trakt.tv/scrobble/start: {'disabled cache': True, 'disabled method': True, 'disabled status': True, 'disabled by filter': False, 'disabled by headers or expiration params': False}
2022-10-01 15:21:02,192 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api-v2launch.trakt.tv/scrobble/start
2022-10-01 15:21:02,192 DEBUG[trakt.core]:RESPONSE [post] (https://api-v2launch.trakt.tv/scrobble/start): <Response [201]>
2022-10-01 15:21:02,193 DEBUG[PlexTraktSync.WatchStateUpdater]:Scrobbled: {'id': 0, 'action': 'start', 'progress': 99.38175304789969, 'sharing': {'facebook': False, 'twitter': False, 'tumblr': False}, 'episode': {'season': 20, 'number': 1, 'title': 'LASIK Instinct', 'ids': {'trakt': 5218878, 'tvdb': 8483603, 'imdb': 'tt13154512', 'tmdb': 3010853, 'tvrage': None}}, 'show': {'title': 'Family Guy', 'year': 1999, 'ids': {'trakt': 1425, 'slug': 'family-guy', 'tvdb': 75978, 'imdb': 'tt0182576', 'tmdb': 1434, 'tvrage': 3506}}}
2022-10-01 15:21:08,974 DEBUG[plexapi]:Alert: type size PlaySessionStateNotification
2022-10-01 15:21:08,974 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'playing', 'size': 1, 'PlaySessionStateNotification': [{'sessionKey': '13', 'clientIdentifier': 'xu7dwjic6xl05rf4wp8dbmaa', 'guid': '', 'ratingKey': '190', 'url': '', 'key': '/library/metadata/190', 'viewOffset': 1298000, 'playQueueItemID': 67, 'playQueueID': 13, 'state': 'stopped', 'transcodeSession': '3vli0l0b7skmgsvoohrz9mqw'}]}
2022-10-01 15:21:08,974 DEBUG[trakt.core]:get: https://api-v2launch.trakt.tv/search/tmdb/3010853?type=episode
2022-10-01 15:21:08,974 DEBUG[trakt.core]:headers: {'Content-Type': 'application/json', 'trakt-api-version': '2', 'trakt-api-key': 'REDACTED', 'Authorization': 'Bearer REDACTED'}
2022-10-01 15:21:08,974 DEBUG[trakt.core]:method, url :: get, https://api-v2launch.trakt.tv/search/tmdb/3010853?type=episode
2022-10-01 15:21:08,976 DEBUG[requests_cache.cache_control]:Cache directives from request headers: {}
2022-10-01 15:21:08,976 DEBUG[trakt.core]:RESPONSE [get] (https://api-v2launch.trakt.tv/search/tmdb/3010853?type=episode): request: GET https://api-v2launch.trakt.tv/search/tmdb/3010853?type=episode, response: 200 (322 bytes), created: 2022-10-01 15:20:43 CEST, expires: N/A (fresh)
2022-10-01 15:21:08,977 DEBUG[trakt.core]:get: https://api-v2launch.trakt.tv/search/tmdb/1434?type=show
2022-10-01 15:21:08,977 DEBUG[trakt.core]:headers: {'Content-Type': 'application/json', 'trakt-api-version': '2', 'trakt-api-key': 'REDACTED', 'Authorization': 'Bearer REDACTED'}
2022-10-01 15:21:08,977 DEBUG[trakt.core]:method, url :: get, https://api-v2launch.trakt.tv/search/tmdb/1434?type=show
2022-10-01 15:21:08,978 DEBUG[requests_cache.cache_control]:Cache directives from request headers: {}
2022-10-01 15:21:08,978 DEBUG[trakt.core]:RESPONSE [get] (https://api-v2launch.trakt.tv/search/tmdb/1434?type=show): request: GET https://api-v2launch.trakt.tv/search/tmdb/1434?type=show, response: 200 (171 bytes), created: 2022-10-01 12:16:13 CEST, expires: N/A (fresh)
2022-10-01 15:21:08,979 INFO[PlexTraktSync.WatchStateUpdater]:on_play: <Episode:190:Family-Guy-s20e01>: 99.998074% Watched: True, LastViewed: 2022-10-01 12:16:13
2022-10-01 15:21:08,981 DEBUG[PlexTraktSync.ScrobblerProxy]:stop(<TVEpisode>: Family Guy S20E1 LASIK Instinct): 99.99807399703396
2022-10-01 15:21:08,981 DEBUG[trakt.core]:post: https://api-v2launch.trakt.tv/scrobble/stop
2022-10-01 15:21:08,981 DEBUG[trakt.core]:headers: {'Content-Type': 'application/json', 'trakt-api-version': '2', 'trakt-api-key': 'REDACTED', 'Authorization': 'Bearer REDACTED'}
2022-10-01 15:21:08,981 DEBUG[trakt.core]:method, url :: post, https://api-v2launch.trakt.tv/scrobble/stop
2022-10-01 15:21:08,982 DEBUG[requests_cache.cache_control]:Cache directives from request headers: {}
2022-10-01 15:21:09,448 DEBUG[urllib3.connectionpool]:https://api-v2launch.trakt.tv:443 "POST /scrobble/stop HTTP/1.1" 201 None
2022-10-01 15:21:09,449 DEBUG[requests_cache.session]:Pre-cache checks for response from https://api-v2launch.trakt.tv/scrobble/stop: {'disabled cache': True, 'disabled method': True, 'disabled status': True, 'disabled by filter': False, 'disabled by headers or expiration params': False}
2022-10-01 15:21:09,449 DEBUG[requests_cache.session]:Skipping cache write for URL: https://api-v2launch.trakt.tv/scrobble/stop
2022-10-01 15:21:09,449 DEBUG[trakt.core]:RESPONSE [post] (https://api-v2launch.trakt.tv/scrobble/stop): <Response [201]>
2022-10-01 15:21:09,450 ERROR[PlexTraktSync.EventDispatcher]:'13'
2022-10-01 15:21:09,451 DEBUG[PlexTraktSync.EventDispatcher]:['  File "/home1/mrrobot/custom/PlexTraktSync/plextraktsync/listener.py", line 40, in dispatch\n    listener["listener"](event)\n', '  File "/home1/mrrobot/custom/PlexTraktSync/plextraktsync/commands/watch.py", line 139, in on_play\n    scrobbled = self.scrobble(m, percent, event)\n', '  File "/home1/mrrobot/custom/PlexTraktSync/plextraktsync/commands/watch.py", line 161, in scrobble\n    del self.sessions[event.session_key]\n']
2022-10-01 15:21:19,180 DEBUG[plexapi]:Alert: type size TranscodeSession
2022-10-01 15:21:19,180 DEBUG[PlexTraktSync.EventDispatcher]:{'type': 'transcodeSession.start', 'size': 1, 'TranscodeSession': [{'key': '/transcode/sessions/323ql0904yvgllihx061ipin', 'throttled': False, 'complete': False, 'progress': 0.0, 'size': 0, 'speed': 0.0, 'error': False, 'duration': 1294059, 'context': 'streaming', 'sourceVideoCodec': 'h264', 'sourceAudioCodec': 'aac', 'videoDecision': 'copy', 'audioDecision': 'copy', 'protocol': 'dash', 'container': 'mp4', 'videoCodec': 'h264', 'audioCodec': 'aac', 'audioChannels': 2, 'transcodeHwRequested': False, 'transcodeHwFullPipeline': False}]}

Expected behavior

The error should give more info about what's gone wrong.

Steps to reproduce the behavior

  1. plextraktsync.sh watch
  2. Play an episode and either let it end, or click on Stop
  3. Error 'N' will pop

Inspect of problematic items

No response

Workarounds

No response

Install method

git clone

Version

0.21.5

Python Version

3.7.3

Operating System and Version

Debian 10

glensc commented 1 year ago

with log level debug the trace is available. this happens to me if I'm connected to a server I'm not admin but plain user.

ERROR    '151'
DEBUG    [
    '  File "plextraktsync/listener.py", line 40, in dispatch
    listener["listener"](event)\n',
    '  File "plextraktsync/commands/watch.py", line 139, in on_play
    scrobbled = self.scrobble(m, percent, event)\n', 
    '  File "plextraktsync/commands/watch.py", line 161, in scrobble
    del self.sessions[event.session_key]
']
glensc commented 1 year ago

May be fixed wtih https://github.com/Taxel/PlexTraktSync/pull/1081

solid-pixel commented 1 year ago

That's indeed the case, I'm not admin of that server. Or well, I am, but the user I'm linking watch to isn't.

No biggie though, seems to work fine regardless of that. Thank you!

solid-pixel commented 1 year ago

@glensc yep 0.21.6 fixed it, thanks a lot!