Discord Rich Presence implementation for Plex.

Overview

Perplex

Perplex is a Discord Rich Presence implementation for Plex.

Features

  • Modern and beautiful Rich Presence for both movies and TV shows
  • The Movie Database (TMDB) integration for enhanced media information
  • Lightweight console application that runs in the background
  • Support for two-factor authentication (2FA) at login
  • Optional minimal mode for Rich Presence to hide granular information
  • Prioritize multiple Plex Media Servers with one configuration

Installation

Perplex requires Python 3.10 or greater. Required dependencies can be found in pyproject.toml.

A TMDB API Key is required to enable media art and external information.

Usage

Open config_example.json and provide the configurable values, then save and rename the file to config.json.

python perplex.py

Note: A Discord desktop client must be open on the same device that Perplex is running on.

Comments
  • Unable to Start Bot

    Unable to Start Bot

    Bot will not start and do not know how to fix it.

    Terminal Output Error

    Lucky@Luckys-Mac Perplex % python3 perplex.py
    Traceback (most recent call last):
      File "/Applications/Apps/Programs/Perplex/perplex.py", line 9, in <module>
        import httpx
    ModuleNotFoundError: No module named 'httpx'
    

    config.json

            "severity": "INFO"
        },
        "plex": {
            "username": "(REDACTED)",
            "password": "(REDACTED)",
            "twoFactor": false,
            "servers": ["Plex 'N Chill"],
            "users": ["Zak"]
        },
        "tmdb": {
            "enable": true,
            "apiKey": "(redacted)"
        },
        "discord": {
            "appId": (REDACTED),
            "minimal": false
        }
    }```
    opened by zluckytraveler 4
  • SyntaxError: invalid syntax

    SyntaxError: invalid syntax

    Getting the following when running python3 perplex.py:

      File "perplex.py", line 91
        if (level := settings["severity"].upper()) != "DEBUG":
                  ^
    SyntaxError: invalid syntax
    

    All deps are ok, config.json looks fine. How to resolve?

    opened by ronilaukkarinen 3
  • Add Tautulli media thumbnails support

    Add Tautulli media thumbnails support

    Hello! This is my very first pull request on GitHub, so please let me know what I can do to improve for next time! I added support for Tautulli's image proxy to use as thumbnail art for all media types. This is a fairly simple setup for those who already have a publicly-facing instance of Tautulli connected to their Plex servers, as all it requires is the URL of said instance. Here are examples of it in action: image image image thank you so much for your work on Perplex!

    opened by TetraTsunami 3
  • Fetch session info from specific user

    Fetch session info from specific user

    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.

    enhancement help wanted 
    opened by alecaputo13 3
  • Failed to connect to Discord (Could not find Discord installed and running on this machine.)

    Failed to connect to Discord (Could not find Discord installed and running on this machine.)

    Getting this error when running the script:

    2022-04-20 03:28:57.681 | ERROR    | __main__:LoginDiscord:163 - Failed to connect to Discord (Could not find Discord installed and running on this machine.) retry in 15s...
    
    opened by raphattack 2
  • Enable support for multiple servers at the same time

    Enable support for multiple servers at the same time

    Hi, in the config file you can set multiple server but, for what's i've seen, if the first server is found the others are ignored and the script won't try to fetch sessions from the others.

    Since i own multiple server it would be cool if the script continuously looks for session from all the servers set in the config.json.

    opened by alecaputo13 2
  • Use Token instead of Username Password

    Use Token instead of Username Password

    Hi! Using the PlexAPI you can instead of asking for the username and password and 2FA token directly, you can instead use a plex token like so:

    from plexapi.server import PlexServer
    baseurl = 'http://plexserver:32400'
    token = '2ffLuB84dqLswk9skLos'
    plex = PlexServer(baseurl, token)
    

    The PlexAPI docs have more info.

    opened by KaiDevrim 1
  • [Bug] 401 Unauthorised Handle & Fixing

    [Bug] 401 Unauthorised Handle & Fixing

    Issue

    I'm a user on a Friend's server and I'm able to authenticate with my account however I'm getting a 401 unauthorised when getting the current sessions. My Logs are below to try and help.

    Username & Passwords are correct as I can authenticate my account, Server name is correct as I checked via the debug, and it would have crashed earlier.

    Any Help/Advice you could provide me?

    Traceback:

    Traceback (most recent call last):
      File "$PYTHON_PATH\lib\runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "$PYTHON_PATH\lib\runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "$USER_PATH\.vscode\extensions\ms-python.python-2022.0.1814523869\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
        cli.main()
      File "$USER_PATH\.vscode\extensions\ms-python.python-2022.0.1814523869\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
        run()
      File "$USER_PATH\.vscode\extensions\ms-python.python-2022.0.1814523869\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
        runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
      File "$PYTHON_PATH\lib\runpy.py", line 269, in run_path
        return _run_module_code(code, init_globals, run_name,
      File "$PYTHON_PATH\lib\runpy.py", line 96, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "$PYTHON_PATH\lib\runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "g:\Documents\Github\Perplex\perplex.py", line 418, in <module>
        Perplex.Initialize(Perplex)
      File "g:\Documents\Github\Perplex\perplex.py", line 38, in Initialize
        session: Optional[Union[Movie, Episode, Track]] = Perplex.FetchSession(
      File "g:\Documents\Github\Perplex\perplex.py", line 206, in FetchSession
        sessions: List[Media] = server.sessions()
      File "$USER_PATH\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\plexapi\server.py", line 726, in sessions
        return self.fetchItems('/status/sessions')
      File "$USER_PATH\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\plexapi\base.py", line 260, in fetchItems
        data = self._server.query(ekey, params=url_kw)
      File "$USER_PATH\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\plexapi\server.py", line 678, in query
        raise Unauthorized(message)
    plexapi.exceptions.Unauthorized: (401) unauthorized; https://<Plex-IP-Address>.<Plex-UUID>.plex.direct:32400/status/sessions <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
    

    Console Log:

    2022-02-25 22:12:49.898 | INFO     | __main__:Initialize:29 - Perplex
    2022-02-25 22:12:49.901 | INFO     | __main__:Initialize:30 - https://github.com/EthanC/Perplex
    2022-02-25 22:12:49.908 | SUCCESS  | __main__:LoadConfig:80 - Loaded configuration
    2022-02-25 22:12:50.195 | SUCCESS  | __main__:LoginPlex:139 - Authenticated with Plex
    2022-02-25 22:12:50.446 | SUCCESS  | __main__:LoginDiscord:165 - Authenticated with Discord
    
    opened by Alipoodle 1
  • Added full music capabilities + MusicBrainz API for metadata

    Added full music capabilities + MusicBrainz API for metadata

    Was working on this last night - just realized you implemented in music stuff today!

    Thought i'd put up a pr anyways since I added in a music metadata function grabbing from the free to use MusicBrainz API.

    On my personal local fork, i added in the ability to use the MusicBrainz ID to grab album art from MusicBrainz database - ill clean that up and create a new pr for that as well.

    opened by zane-schaffer 1
  • Added requirements.txt to make installing easier.

    Added requirements.txt to make installing easier.

    Added requirements.txt to make installing easier. pip install -r requirements.txt

    I used this to install and it went fine, bot is working great.

    Great bot btw :+1:

    opened by insomniac-afk 1
  • Wait for Discord to be started

    Wait for Discord to be started

    Since i would love to run this script automatically at startup it would be nice if the script could wait Discord to start instead of throwing exception and extitng. Same thing if Discord get closed and reopened after a while.

    Thank you for the work :)

    opened by alecaputo13 1
  • Fetched active media session of unknown type: <class 'plexapi.video.EpisodeSession'>

    Fetched active media session of unknown type:

    I'm getting errors when playing media.

    Fetched active media session of unknown type: <class 'plexapi.video.EpisodeSession'>

    I'm also wondering if I need to set something up in Discord?

    opened by nagmus 2
  • PlexAPI update

    PlexAPI update

    Updated to work with the latest version of PlexAPI. Was getting error "Fetched active media session of unknown type: <class 'plexapi.video.MovieSession'>" because of a breaking change introduced in 4.12.0 (https://github.com/pkkid/python-plexapi/pull/931)

    opened by asc3ns10n 0
  • Music Cover Art Support

    Music Cover Art Support

    Request for music cover art support, can possibly specify Music Library in Config and then use a Music Database (MusicBrainz, Discogs, VGMdb, last.fm, etc) to fetch cover arts.

    Example: https://github.com/PvtTyphoon/lfm-rich-presence

    opened by Ravencentric 0
  • ERROR    | __main__:LoginDiscord:163 - Failed to connect to Discord

    ERROR | __main__:LoginDiscord:163 - Failed to connect to Discord

    I'm receiving an error when trying to run the application,. how do I fix this this issue?

    Shawn@Macintosh Perplex % python3 perplex.py
    2022-04-26 19:38:30.287 | INFO     | __main__:Initialize:29 - Perplex
    2022-04-26 19:38:30.287 | INFO     | __main__:Initialize:30 - https://github.com/EthanC/Perplex
    2022-04-26 19:38:30.288 | SUCCESS  | __main__:LoadConfig:82 - Loaded configuration
    2022-04-26 19:38:30.292 | SUCCESS  | __main__:SetupLogging:96 - Set logger severity to INFO
    2022-04-26 19:38:30.990 | SUCCESS  | __main__:LoginPlex:141 - Authenticated with Plex
    2022-04-26 19:38:31.002 | ERROR    | __main__:LoginDiscord:163 - Failed to connect to Discord (_UnixSelectorEventLoop.create_unix_connection() got an unexpected keyword argument 'loop') retry in 15s...
    2022-04-26 19:38:46.006 | SUCCESS  | __main__:LoginDiscord:167 - Authenticated with Discord
    2022-04-26 19:39:16.765 | SUCCESS  | __main__:Initialize:45 - Fetched active media session
    Traceback (most recent call last):
      File "/Users/Shawn/Applications/Perplex/perplex.py", line 420, in <module>
        Perplex.Initialize(Perplex)
      File "/Users/Shawn/Applications/Perplex/perplex.py", line 50, in Initialize
        status: Dict[str, Any] = Perplex.BuildEpisodePresence(self, session)
      File "/Users/Shawn/Applications/Perplex/perplex.py", line 300, in BuildEpisodePresence
        if (active.seasonNumber is not None) and (active.episodeNumber is not None):
      File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/plexapi/base.py", line 428, in __getattribute__
        value = super(PlexPartialObject, self).__getattribute__(attr)
    AttributeError: 'Episode' object has no attribute 'episodeNumber'
    
    opened by trinity8746 0
Owner
Ethan
Loser
Ethan
Acc-discord-rpc - Assetto Corsa Competizione Discord Rich Presence Client

A simple Assetto Corsa Competizione Rich Presence client. This app only works in

null 6 Dec 18, 2022
Discord rich-presence implementation for VALORANT

not working on v1 anymore in favor of v2, but if there's any big bugs i'll try to fix them valorant-rich-presence-client Discord rich presence extensi

colinh 278 Jan 8, 2023
Unofficial Discord Rich Presence for HackTheBox platform

HTBRichPresence Unofficial Discord Rich Presence for HackTheBox platform The project is under lazy development. How to run Install requirements: // I'

Antonio 4 Apr 19, 2022
OpenEmu Discord Rich Presence provided with Python!

A simple application that provides your current OpenEmu game as an RPC state in Discord via PyPresence. How to use Unzip and open the latest x86_64 ve

Deltaion Lee 6 May 30, 2022
A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studying.

Studying RPC Description A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studyin

John Edmerson Pizarra 4 Nov 19, 2022
Discord Rich Presence for Team Fortress 2

TF2 Rich Presence Discord Rich Presence for Team Fortress 2 Detects current game state, queue info, playtime, and more Configurable, reliable, and per

Kataiser 33 Dec 31, 2022
Rich presence app for playstation 3. Display what game you are playing on the PS3 via Discord

PS3-Rich-Presence-for-Discord Discord Rich Presence script for PS3 consoles on HFW&HEN or CFW. Written in Python. Display what you are playing on your

null 17 Dec 11, 2022
With this simple app you can customize your presence in Discord.

Discord Rich Presence This a simple console app which can customize your Discord Presence easily, with only one config file! Setup Go to Discord Devel

Mai 1 Jan 6, 2022
PlexAutoSkip - Automatically skip content in Plex

PlexAutoSkip Automatically skip tagged content in Plex A background python scrip

Michael Higgins 97 Dec 21, 2022
A modern, easy to use, feature-rich, and async ready API wrapper improved and revived from original discord.py.

A Python API wrapper that is improved and revived from the original discord.py

Orion 19 Nov 6, 2021
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async and await

Senpai Development 4 Nov 5, 2021
A modern,feature-rich, and async ready API wrapper for Discord written in Python

discord.io A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using asyn

Vincent 18 Jan 2, 2023
Low-level, feature rich and easy to use discord python wrapper

PWRCord Low-level, feature rich and easy to use discord python wrapper Important Note: At this point, this library API is considered unstable and can

MIguel Lopes 1 Dec 26, 2021
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

disfork A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async a

null 2 Feb 9, 2022
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.

Reco PC Server Reco PC Server is a cross platform PC Controller Discord Bot which is a modified and improved version of Chimera for Reco-Discord PC Re

Arvinth Krishna 12 Aug 31, 2022
A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)

Articuno (discord-interactions) A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py) Get started If you wa

Blue 8 Dec 26, 2022
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Théo 2 Sep 15, 2022
Discord bot script for sending multiple media files to a discord channel according to discord limitations.

Discord Bulk Image Sending Bot Send bulk images to Discord channel. This is a bot script that will allow you to send multiple images to Discord channe

Nikola Arbov 1 Jan 13, 2022
DeKrypt 24 Sep 21, 2022