-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: added update
command to update uosc
#700
Conversation
I prefer to use this mpv_manager script to uniformly manage mpv scripts and shader updates, which is simpler and more convenient. Maybe you just need to link it in the Docs and provide a usage method. [
{
"git":"https://github.com/tomasklaen/uosc",
"whitelist":"scripts$",
"dest":"~~/scripts",
"branch":"main"
}
] |
I'm also using another method to keep I'm a Linux user so I've just tried it. Maybe I'm doing something wrong but it doesn't seem to work on my end. After running After restarting Edit: I've just tried the ./unix.shDeleting old and deprecated uosc files and directories.
Downloading: https://github.com/tomasklaen/uosc/releases/latest/download/uosc.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 278k 100 278k 0 0 355k 0 --:--:-- --:--:-- --:--:-- 864k
Extracting: /tmp/uosc.zip
Archive: /tmp/uosc.zip
inflating: /home/xfzv/.config/mpv/fonts/uosc_icons.otf
inflating: /home/xfzv/.config/mpv/fonts/uosc_textures.ttf
inflating: /home/xfzv/.config/mpv/scripts/uosc.lua
creating: /home/xfzv/.config/mpv/scripts/uosc_shared/
creating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/BufferingIndicator.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Button.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Controls.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Curtain.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/CycleButton.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Element.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Elements.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Menu.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/PauseIndicator.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Speed.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Timeline.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/TopBar.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/Volume.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua
creating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/ass.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/menus.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/std.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/text.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/lib/utils.lua
inflating: /home/xfzv/.config/mpv/scripts/uosc_shared/main.lua
Deleting: /tmp/uosc.zip
uosc has been installed. |
Maybe there's something wrong here? cff7fa8#diff-b3987901b1d4877a672cb09d6728c46ad4964868098aa7dc5d589fd0d7785f3bR19-R20 I don't know how the command is actually executed from the
$ /bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)
$ /bin/bash -c '$(curl -fsSL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)'
/bin/bash: line 1: #!/bin/bash: No such file or directory
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)"
Deleting old and deprecated uosc files and directories.
Downloading: https://github.com/tomasklaen/uosc/releases/latest/download/uosc.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 278k 100 278k 0 0 287k 0 --:--:-- --:--:-- --:--:-- 4884k
[...] The Line 58 in 3e685c5
|
The quotes are usually omitted when string is passed as an array argument. Just as there are no quotes in powershell command above either, and it works fine. But duno, maybe it's different for bash? Did you try adding the quotes to the args array? All right, I'll install some linux VM, and test it later. |
In my case it seems to be caused by the wrong shebang: |
I'll look into it more tomorrow, but in the meantime: @po5 you seem to have a lot of experience with running subprocesses from mpv scripts :) Is it possible to:
|
idk about having scripts update themselves. It's very reminiscent of the windows ecosystem where each application has it's own update mechanism built in (although I heard something that package mangers are becoming more common?). I guess it could be useful for people that only use/update uosc and no other scripts. |
Yeah I absolutely hate it too, but what else are they supposed to do when there's no package manager? Windows store absolutely sucks. And it's the same here. If I could make the update screen be a UI for some mpv script manager, I would, but there's nothing established or not abandoned, let alone something with an API. So at least I make it for uosc.
That's exactly my case on my media laptop :) I just want to quickly update uosc from time to time and get to watching. That's the main reason I'm adding this updater - I want to make my life easier. |
To run the update script, this works:
Don't think you can do that, but you can redirect output to a file and read it through lua.
What are you trying to do with this? I expect this to only touch the mpv config dir, whose path you already have access to. |
Thank you! I was just scratching my head on this :)
I need to run the subprocess in the same directory as mpv.exe, so that the Or maybe I should instead figure out how to set some Pointers for each would be appreciated :) |
So you don't need the mpv.exe path, only the correct config path? If the user previously installed uosc in that dir, then it will be running from that dir, and that's what will be returned by |
Yeah getting the scripts directory has never been the problem :) The problem is either 1.) getting mpv binary directory, or 2.) how to define an env variable for the Both of these would allow me to solve the problem. The env variable solution would be better, as then the updater wouldn't have to guess the mpv config directory on linux systems (I'm appending the unix installer with detecting Flatpak installs atm, but with the env variable at least updating wouldn't have to guess). I don't have much experience writing and running bash/powershell scripts if you can't tell :) |
So I've solved most issues. The updater now always updates exactly the uosc instance that started it. The config path is just added to existing environment variables as The only issue is this command args table:
Works fine on PopOS, but on Ubuntu I get "curl: command not found" error, even though curl is installed (using the linux install command from readme in terminal works fine), and I'm out of ideas how to fix it :( If it wasn't enough, this error is not recognized as an error by |
What if you download the script to /tmp/ and then run it with bash in a separate I don't know what to do about the curl call failure. You can try |
I did local url = 'https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh'
local args = {'/bin/bash', '-c', 'source <(/usr/bin/curl -fsSL ' .. url .. ')'} And the result: If I try first downloading the script with: local args = {'curl', '-Ls', '-o', '/tmp/uosc-unix-installer.sh', url} I get:
No stdout or err, just an empty fail. If I try
Another empty error.
All commands above executed with: mp.command_native_async({
name = 'subprocess',
capture_stderr = true,
capture_stdout = true,
playback_only = false,
args = args,
}, function(success, result, error)
print('success:', utils.to_string(success))
print('error:', utils.to_string(error))
print('result:', utils.to_string(result))
end) I don't know what else to try. This is Ubuntu 23 btw, and only when running anything through It's a fresh install of Oh wait, the mpv is installed as a snap package. I think that might have something to do with it. |
Splitting up Also isn't |
updater.mp4
If anyone can test it on linux/mac, it'd be great, but be aware that it's going to replace your current uosc in
~/.config/mpv
with the latest release, which is 4.7.The only issue this has now (that I know of) is that to do a windows portable update, I need to know the path to mpv binary so the updating process can run in its working directory.
Is there a way to get it somehow? And is there some arg to
mp.command_native_async()
to set the working directory? Can't find info on any of these. But I haven't tried super hard, so hopefully it's still doable :)