EthanC / Perplex

Discord Rich Presence implementation for Plex.
MIT License
86 stars 10 forks source link

Fetch session info from specific user #2

Closed alecaputo13 closed 2 years ago

alecaputo13 commented 2 years ago

I have another enanchment feature to request. I have my own Plex server where i invited many friends. If any of them is watching something on my server the script detects the watching status as if I was watching it. It would be cool if we could choose for which user fetching session to.

EthanC commented 2 years ago

This is a limitation that I'm aware of, but I have yet to find a comfortable solution for it. The Movie and Episode classes in pkkid/python-plexapi do not appear to have any ability to discern which user (name or id) is responsible for the session.

For anybody looking to contribute this Issue, there are two theoretical solutions - the first of which would be preferred:

  1. Add an array to config.json, similar to the servers array, and prioritize sessions from users in this list.
  2. First, prompt the user to choose one of the active sessions if there are multiple. Then save a unique identifier of the user responsible for the session and use it for subsequent updates.
alecaputo13 commented 2 years ago

I don't know if this can help but there's an old script like this which had an option called 'listen for user' https://github.com/Phineas05/discord-rich-presence-plex

EthanC commented 2 years ago

Nice! It seems that pkkid/python-plexapi doesn't explicitly expose the usernames array anywhere, but it does exist.

I've added a users field to the config, just enter Plex usernames in there and Perplex will use the first one that it finds active.