theHandy support for PlexMediaServer

What
What this software does is, it runs on your PlexMediaServer and detects when you play (or stop) a video.
It then sends a play signal to theHandy, if said video has a funscript, and plays the funscript.

Why
To use theHandy on my mobile phone and other devices, i felt a good cross-platform approach was needed.
So i firstly developed my own media server, it was decent, but finding compatibility profiles for video codec’s on largely undocumented webbrowsers is a nightmare.
So i decided to check if PMS could do this, and it could.
So now anything that has access to your plex server can run theHandy, this includes desktop, mobile, smart tv’s, consoles etc.

How
It works as a Plex webhook (requires plexpass/payment).
What this does is that, when you start, play, pause or stop a video’s playback, it sends a signal to my python script, which can then ask the server what video file it is.
I can then check for if said video file has a funscript, and then just send said file to handyfeeling.com and ask their handyAPI to run it from there.

Download

NodudeWasTaken/theHandy_Plex (github.com)

Please read the git description on how to install and use it.
As you might guess there is also a certain latency, as the process of going from device->server->my script has an undefined latency.
Its generally low if you’re local, but please just stop and start to fix this.
There’s also a load of other known bugs on the github, that you should read before sending them to me.

Feel free to write suggestions on how to fix said bugs :smile:

An image
plex_image

20 Likes

You definitely should post this to reddit.com: over 18? ! I’m sure https://reddit.com/u/HandyAlexander and his team will love this!

1 Like

Hi, i tried installing the script but i have runtime errors .

  File "plex.py", line 3, in <module>
    from handy import TheHandy, upload_funscript
  File "/root/theHandy_Plex/handy.py", line 125
    print(data, file=sys.stderr)

Yeah, this is my fault for not writing a detailed enough readme.
You need both handy.py and plex.py downloaded and in the same folder to run this.
You need python 3.
You need libraries requests and flask (do: pip install requests, pip install flask).
And finally you need to run plex.py.

hello, a mistake by myself, I forgot to specify python3 in the execution of the script. Probably because I tested quickly before sleeping. Thanks for the informations
for installation.

I just updated this, fixing all viewOffset bugs.
Instead of trusting the included viewOffset, i now manually search the sessions of plex to find it, and this is both more accurate and more consistent.
EDIT:
I still have initial sync issues, but otherwise its great

1 Like

This is awesome! Currently I have Plex playing my 2d Videos with theHandy support through DeoVR but this would be awesome for when I don’t have my headset. Well done!

1 Like

Alright, i now switched to the v2 branch since it seems pretty stable by now, and it improves alot of things:

  • It now has a config file, no more editing the script.
  • The experimental plex latency calculator is now “stable”, and works quite well, find the latency once, and use it for this session. It starts by sending 30 pause/play messages to your viewer to finding the latency of the command. Now that it knows how long it takes to send message to the viewer, we can now find the latency of the viewer pausing and us getting the pause report, and we do this by using pause/play 30 times again, and waiting for the messages each time (in reality this takes a couple of seconds at most).
  • Sessions, 1 session is 2 hours of no plex actions received, in this time it remembers your handy and doesn’t have to setup sync and delay again.
  • Local file sync, sync files at the speed of sound by sending directly to the handy from your server.
  • Uses the new Handy API for firmware 3.

You still have to pause and play sometimes, but way less.

Any possiblity for something equal on emby?

1 Like

Is there a way to run this on a windows based plex server?