Last active
November 21, 2023 15:14
-
-
Save Sneakpeakcss/05a97d509b8be67a6f11400b0bee54ab to your computer and use it in GitHub Desktop.
mpv player script to open directory and select currently playing file (Windows).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- open-in-explorer.lua | |
mp.add_key_binding(nil, "open-in-explorer", function() | |
local path = mp.get_property("path") | |
if path ~= nil and not path:match("^%a[%a%d-_]+://") then | |
path = string.gsub(path, "/", "\\") | |
mp.command_native({ | |
name = "subprocess", | |
playback_only = false, | |
args = { 'explorer', '/select,', path .. ' ' }, | |
}) | |
else | |
mp.osd_message("Invalid path: " .. (path or "No path provided")) | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yea, a trailing space was all it takes to fix this. I've submited the mentioned PR.