Skip to content

Conversation

@StratusFearMe21
Copy link

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).

{repeatable=false})

-- run `main` function
io.popen('python3 "/media/isaac/Games/Home/isaac/.config/mpv/scripts/mpv-discordRPC/python-pypresence.py" &')
Copy link
Owner

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

Copy link
Author

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

Copy link
Owner

@cniw cniw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0ea5638 this is a new feature you shouldn't remove it, this #14

@StratusFearMe21
Copy link
Author

sorry, I was editing an outdated version. Should be fixed now. I also changed the filenames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants