discord-rich-presence-plex: Connected to Plex, Not showing in Discord

I have installed plexapi, websocket-client==0.48.0, and and set my configuration in the file properly, it’s connected to the server and listening for specific username which it finds, and I have activity status turned on in my profile settings. However nothing is appearing in my profile as a watching/playing status. I’m a bit at a loss and not sure what else to do here.

Output

[05:39:56 PM] [Plex N Chill/06ae7] Logged in as Plex User "Plex.N.Chill"
[05:40:27 PM] [Plex N Chill/06ae7] Connected to Plex Media Server "Plex N Chill"
[05:40:27 PM] [Plex N Chill/06ae7] Listening for PlaySessionStateNotification alerts from user "zak"
[05:51:49 PM] [Plex N Chill/06ae7] <Episode:630835:We-Own-This-City-s01e01>, Session Key: 543, Users: ["Zak"]
[05:51:49 PM] [Plex N Chill/06ae7] Session found
[05:51:49 PM] [Plex N Chill/06ae7] Username "zak" matches "zak", continuing
[05:51:49 PM] [Plex N Chill/06ae7] Opening Discord IPC Pipe
[05:51:49 PM] [Plex N Chill/06ae7] [HANDSHAKE] _UnixSelectorEventLoop.create_unix_connection() got an unexpected keyword argument 'loop'
[05:51:49 PM] [Plex N Chill/06ae7] Closing Discord IPC Pipe
[05:51:49 PM] [Plex N Chill/06ae7] Received Update: {"sessionKey": "541", "clientIdentifier": "396bbacfe499509-com-plexapp-android", "guid": "plex://movie/5d776841961905001eb965e3", "ratingKey": "566460", "url": "", "key": "/library/metadata/566460", "viewOffset": 718323, "playQueueItemID": 156249, "playQueueID": 6550, "state": "playing"}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 46 (12 by maintainers)

Most upvoted comments

@zluckytraveler I have implemented the ability to display posters vide commit https://github.com/phineas05/discord-rich-presence-plex/commit/a40dbb45e8391b8b0b1c849e7610b81eded58414.

Refer to the README for instructions on obtaining an Imgur client ID and add the client ID to your config.json as per the specified format.

Also, the Discord client/application ID in the code has been moved here.

I really don’t know what it means when you say you refactored the application, what exactly does this mean for us the end user? Also is there anything different as far as features or how the application works, besides the obvious of the installation and files, etc?

It basically means restructuring the code. The project consisted of a 400-line single file earlier which is messy and hard to read and maintain. In the process of refactoring it, I’ve split that file up into multiple ones, fixed some code smell and removed unneeded code.

I also noticed that your repo doesn’t have any releases or notes, it may be helpful for users to know what changes have been made, along with supplying previous release files in those notes, for numerous reasons.

There hasn’t been any major functionality changes ever since the first iteration of the script, plus I originally created this mainly for personal use not expecting it to grain traction, so I didn’t think multiple releases, changelogs or meaningful commit messages were required. For the recent changes, the commit messages can somewhat act as a changelog and you can always browse the repository as it was at an earlier commit to obtain older releases.

I just noticed that the exact original error code that we were receiving is exactly the same as this other repo called Perplex. Anyways I went back to check the files for loop=self.loop to see if I could fix the issue with the same solution here, and I couldn’t find it anywhere to be removed, which is making me wonder why it would happening for this other RPC. Just kinda got me thinking, since you got “waist deep” haha

That project depends on pypresence to communicate with Discord so the code from that library might be causing the issue.

I originally wanted to use that one because it had showed the poster for the media being streamed which was super nice

I was looking into this earlier and got started by figuring out fetching poster URLs from Plex. It wasn’t possible when I checked a few years ago because the images that could be displayed in Rich Presence were restricted to the assets uploaded under your application on the Discord Developer Portal but passing the URL to an image instead of an asset key seems to work now. Will try to implement it in the near future.

@zluckytraveler Thank you for testing and for the suggestions.

  1. Listen For Users will not match the session if you enter in any capitalizations into the config file to match the users actual name as displayed on Plex.

Example: My Plex Username is Zak script will not match it because it only looks for zak

This should be fixed by the changes made in the latest commit.

  1. Would be nice if the output was color coded like before, it really helps to identify a match, instead of having to manually try and scroll through a list to find it. I have 100 users on my Plex media server, and at any given time there are 20-40 users streaming.

I plan on refining the output more and adding back the colours. The old code with the colours was messy so I just removed it for now during the refactor.

  1. The config file isn’t very user friendly to those who dont understand the formatting very well. You may want to set it up like a traditional .json, or maybe even .yml file.

I’ll be adding console commands which allow users to edit the config instead of having to edit the JSON file directly, which should hopefully help.

In the prior version all I had to do was input my discord application id and keep the art assets photo named “logo” in order to use my own photo. Will it work the same for this release? If so, in which file and line can I input my own discord application id?

You can change the client/application ID here. Note that along with the “logo” asset, three more assets currently exist and are used as small icons for the different media states: “playing”, “paused”, and “buffering”.

image playing: https://cdn.discordapp.com/app-assets/413407336082833418/413414267618852866.png paused: https://cdn.discordapp.com/app-assets/413407336082833418/413414293112094730.png buffering: https://cdn.discordapp.com/app-assets/413407336082833418/413414325248589836.png

You might be able to pass a “type” variable through containing the integer that indicates if it’s a game, music, stream, etc. Check out this documentation: https://discord.com/developers/docs/topics/gateway#activity-object-activity-types

Note the additional “type” parameter that is getting passed through. The integer should match what is documented in that discord developer/api link above.

Would need to be tested. Not sure if this works.

I’m in the process of refactoring the project. I tried this a while back and it doesn’t seem to work.

Refer to this page where it says the following:

ActivityType is strictly for the purpose of handling events that you receive from Discord; though the SDK/our API will not reject a payload with an ActivityType sent, it will be discarded and will not change anything in the client.