Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions mpv-discordRPC/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,20 @@ local function main()
end
-- run Rich Presence with pypresence
local todo = idle and "idle" or "not-idle"
local command = ('python "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"'):format(pythonPath, todo, presence.state, presence.details, math.floor(startTime), math.floor(timeUp), presence.largeImageKey, presence.largeImageText, presence.smallImageKey, presence.smallImageText, o.periodic_timer)
local command = ('%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s'):format(pythonPath, todo, presence.state, presence.details, math.floor(startTime), math.floor(timeUp), presence.largeImageKey, presence.largeImageText, presence.smallImageKey, presence.smallImageText, o.periodic_timer)
mp.register_event('shutdown', function()
todo = "shutdown"
command = ('python "%s" "%s"'):format(pythonPath, todo)
io.popen(command)
command = ('%s\n%s'):format(pythonPath, todo)
file = io.open('/dev/shm/testfile.txt',"w")
io.popen('')
file:write(command)
file:close()
os.exit()
end)
if o.active == "yes" then
io.popen(command)
file = io.open('/dev/shm/testfile.txt',"w")
file:write(command)
file:close()
end
end
end
Expand Down Expand Up @@ -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" &')
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

mp.add_periodic_timer(o.periodic_timer, main)