Skip to content

Instantly share code, notes, and snippets.

@kankadev
Created February 14, 2023 08:09
Show Gist options
  • Save kankadev/c72b18ee502f72cf1801a12ec383afc3 to your computer and use it in GitHub Desktop.
Save kankadev/c72b18ee502f72cf1801a12ec383afc3 to your computer and use it in GitHub Desktop.
[Open Directory VLC Plugin] This plugin opens the file explorer window of the directory where the current playing video is located. #vlc #lua
--[[
Open Directory VLC Plugin
This plugin opens the file explorer window of the directory where the current playing video is located.
Installation:
1. Move this file to the VLC plugins directory. On Windows, the default directory is "C:\Program Files (x86)\VideoLAN\VLC\lua\extensions".
2. Restart VLC.
3. Play a file.
4. Go to "View" and click on the plugin's name. The directory of the current playing file will be opened.
]]--
function descriptor()
return { title = "Open Directory";
version = "1.0";
author = "kanka.dev";
url = "https://kanka.dev";
shortdesc = "Opens the directory of the current playing video.";
description = "This plugin opens the file explorer window of the directory where the current playing video is located. Thanks to ChatGPT for support. :-)";
capabilities = { "input-listener" } }
end
function activate()
local input = vlc.object.input()
if input then
local path = vlc.input.item(input):uri()
path = vlc.strings.decode_uri(path)
path = string.gsub(path, "/[^/]+$", "")
path = string.gsub(path, "/", "\\")
vlc.msg.info("Opening directory: " .. path)
os.execute('start "" "' .. path .. '"')
else
vlc.msg.err("No input found.")
end
vlc.deactivate()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment