-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Feature Request] yt-dlp button #84
Comments
I was going to add this when I was re-doing the project at the start, but I stopped because I don't have access to Mac or Linux desktops. I have a couple of Raspberry Pis and NAS enclosures that run headless, nothing with a desktop environment though. For example, on ModernX, they use: local function openFolder()
local device = "linux"
if os.getenv("windir") ~= nil then
device = "windows"
elseif os.execute '[ -d "/Applications" ]' == 0 and os.execute '[ -d "/Library" ]' == 0 or os.execute '[ -d "/Applications" ]' == true and os.execute '[ -d "/Library" ]' == true then
device = "mac"
end
-- for ubuntu
local url_browser_linux_cmd = "xdg-open \"$url\""
local file_browser_linux_cmd = "dbus-send --print-reply --dest=org.freedesktop.FileManager1 /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:\"file:$path\" string:\"\""
local url_browser_macos_cmd = "open \"$url\""
local file_browser_macos_cmd = "open -a Finder -R \"$path\""
local cmd = ""
if device == "linux" then
cmd = file_browser_linux_cmd
elseif device == 'windows' then
localpath = localpath:gsub("/", "\\")
local ret = mp.command_native_async({
name = "subprocess",
args = {"explorer", localpath}
})
elseif device == "mac" then
cmd = file_browser_macos_cmd
end
cmd = cmd:gsub("$path", localpath)
if device ~= 'windows' then
os.execute(cmd)
end
end I would change it to: local function open_folder(localpath)
local device = package.config:sub(1,1) == "\\" and "windows" or (os.getenv("OSTYPE") == "darwin" and "mac" or "linux")
local commands = {
linux = 'dbus-send --print-reply --dest=org.freedesktop.FileManager1 /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://%s" string:""',
mac = 'open -R "%s"',
windows = {"explorer", "%s"} -- handled as subprocess
}
-- platform-specific
if device == "windows" then
localpath = localpath:gsub("/", "\\") -- convert path separators for Windows
mp.command_native_async({
name = "subprocess",
args = {commands.windows[1], string.format(commands.windows[2], localpath)}
})
else
os.execute(string.format(commands[device], localpath))
end
end But unfortunately I can't test if my simpler logic works or not for the other platforms. I'll tinker around and see if I can come up with a solid implementation. Give me a couple of days. I can't promise anything though, but I will do my best. |
awesome tyvm :D |
I've added the yt-dlp download feature here: Could you test and give feedback if you face any problems, please? I'll bother @Keith94 and @Xurdejl in case they're interested as well. New options:
Commit: 425c670 Process: (Detecting and downloading) modernz: Web video detected.
modernz: Fetching file size...
modernz: File size: 52601389 B (Download size: 50.2 MB)
modernz: Executing command: yt-dlp --remux mp4 --add-metadata --embed-subs -o %(title)s -P [FULL-PATH]Desktop/mpv [URL]
modernz: Download completed Notes:
Download button behavior:
|
Ooops, there was a missing |
awesomeness, works correctly so far in mpv.net, still has that weird yt-dlp container bug with some files where you have to rename it to .mp4 manually, but otherwise great 👍 |
doesnt have the description like modernx but ey im just glad it works XD |
Update yt-dlp and ffmpeg if you can, it will be fixed.
Youtube description/comments/likes is something I don't plan on adding, to be honest. |
almost perfect, amazing work, this is all i can find that i think is missing.
The text was updated successfully, but these errors were encountered: