-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python Pypresence better integration #15
base: master
Are you sure you want to change the base?
Conversation
mpv-discordRPC/main.lua
Outdated
@@ -277,4 +282,5 @@ mp.add_key_binding(o.key_toggle, "active-toggle", function() | |||
{repeatable=false}) | |||
|
|||
-- run `main` function | |||
io.popen('python3 "/media/isaac/Games/Home/isaac/.config/mpv/scripts/mpv-discordRPC/python-pypresence.py" &') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use hard coded file path.
just use python
instead of python3
explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I used python
instead of python3
it gave me errors about pypresense not existing, and when I installed it with pip it gave me invalid syntax errors. I guess that could just be a Linux thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I was editing an outdated version. Should be fixed now. I also changed the filenames. |
Hi! It's difficult to get two languages to work together in harmony but I think I have a solution that would allow more people to use this plugin. I was having a problem where your plugin would clog up discord by opening too many instances of python at once and not closing them properly. But my solution allows for python to only be opened once, and then closed only when mpv is finished. It makes lua write to a plain text file in /dev/shm (A linux directory that writes directly to RAM) and then have python read that file every 4 seconds (to avoid asyncio problems) and update discord accordingly. At the moment my implementation only works with Linux because /dev/shm doesn't exist in Windows. But that directory should be able to be easily replaced by a variable in the config file (I don't know how those work yet so I couldn't implement it).