phin05 / discord-rich-presence-plex

Displays your Plex status on Discord using Rich Presence
MIT License
281 stars 35 forks source link

No updates from session key, stopping #26

Closed melvyn2 closed 4 years ago

melvyn2 commented 4 years ago

After less than a minute of working properly, the script says No updates from session key (number), stopping and stops working. This was working 2 weeks ago, so probably a plex api issue?

jacobmix commented 4 years ago

Still works for me. You sure nothing has changed? I'm using a Token to connect btw. Have you tried reinstalling it, and redoing the settings? Maybe try some of the stuff here: https://github.com/Phineas05/discord-rich-presence-plex/issues/20#issuecomment-625757212

melvyn2 commented 4 years ago

I've already set this up the suggested way, and it was previously working, so installation instructions weren't too useful - thanks anyways. I've tried re-downloading the script and going from there, and tried a password instead of a token. I've also updated plexapi. Nothing changes - it works for a minute, then stops. Server is running Plex 1.19.3.2764-ef515a800 if it matters.

jacobmix commented 4 years ago

1.19.3.2764 is the newest version of Plex Media Server, and works fine for me so that's not the issue. Do you get anything if you go to http://PlexServerIPHere:32400/status/sessions?X-Plex-Token=TokenHere? Without having another connection, and playing something. Should load, and just say 0 sessions. but also try while connected, and playing something. Should give a lot more info.

melvyn2 commented 4 years ago

Not sure what you mean by "without connected", but going to that path with a valid token does give me the expected session xml.

jacobmix commented 4 years ago

When does it say this? You say after a minute. What does the window say right before? Like this (Tho "Right click>Mark>Left click, and drag>Right click" should copy the text): image

melvyn2 commented 4 years ago
[10:55:07 AM] [musiPi/81540] Logged in as Plex User "melvyn2"
[10:55:08 AM] [musiPi/81540] Connected to Plex Media Server "musiPi"
[10:55:08 AM] [musiPi/81540] Listening for PlaySessionStateNotification alerts from user "melvyn2"
[10:55:13 AM] [musiPi/81540] Received Update: {"sessionKey": "9", "guid": "", "ratingKey": "3369", "url": "", "key": "/library/metadata/3369", "viewOffset": 7035, "playQueueItemID": 24964, "state": "playing"}
[10:55:13 AM] [musiPi/81540] Checking Sessions for Session Key 9
[10:55:13 AM] [musiPi/81540] <Track:3369:penultimatum>, Session Key: 9, Users: ["melvyn2"]
[10:55:13 AM] [musiPi/81540] Session found
[10:55:13 AM] [musiPi/81540] Username "melvyn2" matches "melvyn2", continuing
[10:55:13 AM] [musiPi/81540] Opening Discord IPC Pipe
[10:55:13 AM] [musiPi/81540] [WRITE] {"v": 1, "client_id": "413407336082833418"}
[10:55:13 AM] [musiPi/81540] [READ] {'cmd': 'DISPATCH', 'data': {'v': 1, 'config': {'cdn_host': 'cdn.discordapp.com', 'api_endpoint': '//ptb.discordapp.com/api', 'environment': 'production'}, 'user': {'id': '310513933763215361', 'username': 'removed', 'discriminator': '0000', 'avatar': '00000', 'bot': False, 'flags': 32, 'premium_type': 0}}, 'evt': 'READY', 'nonce': None}
[10:55:13 AM] [musiPi/81540] [WRITE] {"cmd": "SET_ACTIVITY", "args": {"activity": {"details": "penultimatum", "state": "Morch Kovalski \u00b7 unforeseen consequences", "assets": {"large_text": "Listening to Music", "large_image": "logo", "small_text": "Playing", "small_image": "playing"}, "timestamps": {"start": 1588960506}}, "pid": 2789}, "nonce": "1588960513.46023702621459960938"}
[10:55:13 AM] [musiPi/81540] [READ] {'cmd': 'SET_ACTIVITY', 'data': {'details': 'penultimatum', 'state': 'Morch Kovalski · unforeseen consequences', 'assets': {'large_text': 'Listening to Music', 'large_image': '413413572194992129', 'small_text': 'Playing', 'small_image': '413414267618852866'}, 'timestamps': {'start': 1588960506000}, 'name': 'Plex', 'application_id': '413407336082833418'}, 'evt': None, 'nonce': '1588960513.46023702621459960938'}
[10:55:48 AM] [musiPi/81540] No updates from session key 9, stopping
[10:55:48 AM] [musiPi/81540] Closing Discord IPC Pipe
jacobmix commented 4 years ago

Was able to get the error on my side. But it just goes back to working again right after.

[08:02:47 PM] [Plex - Jacob's Dungeon/38510] Request for clients list to check c
onnection: [<PlexClient:http://192.168.1.2:3:MIX-PC>]
[08:02:55 PM] [Plex - Jacob's Dungeon/38510] No updates from session key 209, st
opping
[08:04:28 PM] [Plex - Jacob's Dungeon/38510] Closing Discord IPC Pipe
[08:04:28 PM] [Plex - Jacob's Dungeon/38510] Checking Sessions for Session Key 2
09
[08:04:28 PM] [Plex - Jacob's Dungeon/38510] <Episode:48527:The-Midnight-Gospel-
s01e04>, Session Key: 209, Users: ["JacobMIX"]
[08:04:28 PM] [Plex - Jacob's Dungeon/38510] Session found
[08:04:28 PM] [Plex - Jacob's Dungeon/38510] Username "jacobmix" matches "jacobm
ix", continuing

No real clue why i got the error tho. Was just doing a lot of things, and the CMD window froze, and had it when it came back. Is your memory or CPU maxed out?

melvyn2 commented 4 years ago

no, all were more than 50% unused when I tested this.

jacobmix commented 4 years ago

Try enabling extraLogging, and see if you get any more info? Seems strange it'd just stop there. Also are you running it as administrator? What OS are you running this on? What version? Have you tried running the script on another PC? Only thing i could recommend is maybe completely removing, and starting fresh with Python. It's not an obvious error with Python or such. Even that i could get the error, and it still works for me.

melvyn2 commented 4 years ago

The script doesn't stop - it just keep repeating Request for clients list to check connection. extraLogging was already enabled. Being root or not shouldn't matter - I will try running it on another computer.

jacobmix commented 4 years ago

You're running it on Linux then. Maybe your server denies the requests because of some protection? Let me know if it's any different if ran from a different PC. Else i can let you temperately join my server to see if it still fails.

melvyn2 commented 4 years ago

The script works fine on another install - time to find the difference, I guess.

melvyn2 commented 4 years ago

Forgot to close this issue - completely cleaning out the site-packages dir and reinstalling the dependencies fixed the issue.