Closed eko5624 closed 1 year ago
Does the script work fine after running that command?
I guess we just have to make more of an effort to find the actual path to the mpv executable.
This is also an issue on Windows for users that haven't added mpv to path.
This is also an issue on Windows for users that haven't added mpv to path.
No, as a windows portable mpv user, I can confirm that the script works well even though out of PATH.
It is, for those who don't have it in path and are launching mpv from outside its own directory.
eko: Does replacing "mpv"
with "/Applications/mpv.app/Contents/MacOS/mpv"
on this line also work?
https://github.com/po5/thumbfast/blob/14b6a1eb363d693f91caef55d1dcd4999b9f5bb3/thumbfast.lua#L293
Will try to add auto detection of the currently running executable path for a not-too-messy solution.
eko: Does replacing "mpv" with "/Applications/mpv.app/Contents/MacOS/mpv" on this line also work?
https://github.com/hooke007/MPV_lazy/discussions/186#discussioncomment-3875189 We actually tested before and it worked.
The only problem is the bundle app can be placed anywhere, we didn't find the solution to check it.
The docs mention ~~osxbundle/
for Mac and ~~exe_dir/
for Windows.
see https://github.com/mpv-player/mpv/issues/10009 ~~exe_dir/
couldn't work for me.
Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue(Mac).
Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue.
At first glance this uses the exec_path
variable which is user-defined, with a default value of
((os.getenv('PWD') or mp.get_property('working-directory')) .. ':' .. os.getenv('PATH'))
I've used functionally similar code before, but I don't know if that's enough to find the mpv path on Mac.
We already have the PID. There has got to be a way of getting the path from the pid on every OS. On linux readlink /proc/<pid>/exe
gives you the executable path, but no idea how to do it on mac or windows.
on my arch system:
$ ps -o comm= -p PIDHERE
mpv
$ which mpv
/usr/bin/mpv
Is that enough on Mac?
stackoverflow says this could work:
realpath /proc/PIDHERE/exe
ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin
Yes, after running this command it works well on my Mac.
Can you install thumbfast from the mac-test
branch (https://github.com/po5/thumbfast/blob/mac-test/thumbfast.lua), and try the following:
Open a file in mpv through the terminal, hover on the timeline once.
Copy the PID displayed in terminal.
Open a second terminal, don't close mpv.
Run realpath /proc/PID_HERE/exe
(replace PID_HERE)
Run ps -o comm= -p PID_HERE
(replace PID_HERE)
Run which RESULT_OF_PREVIOUS_COMMAND
(replace RESULT_OF_PREVIOUS_COMMAND with result of ps
command above)
Post the output of the 3 commands you ran.
Hopefully that will get us the path to mpv, wherever it happens to be installed, on a Mac system.
/Applications/mpv.app/Contents/MacOS/mpv /Volumes/USB/Downloads/星际穿越.mkv
Cannot find main.* for any supported scripting backend in: /Users/huangjiajia/.config/mpv/scripts
[thumbfast] script-opts/thumbfast.conf:8 unknown key 'tnpath', ignoring
[thumbfast] script-opts/thumbfast.conf:29 unknown key 'min_duration', ignoring
[thumbfast] script-opts/thumbfast.conf:31 unknown key 'precise', ignoring
[thumbfast] script-opts/thumbfast.conf:33 unknown key 'frequency', ignoring
[uosc] script-opts/uosc.conf:126 unknown key 'font_height_to_letter_width_ratio', ignoring
[thumbfast] PID 6850
Open second terminal:
huangjiajia@huangjiajiadeMacBook-Pro ~ % realpath /proc/6850/exe
realpath: /proc/6850/exe: No such file or directory
huangjiajia@huangjiajiadeMacBook-Pro ~ % ps -o comm= -p 6850
/Applications/mpv.app/Contents/MacOS/mpv
huangjiajia@huangjiajiadeMacBook-Pro ~ % which /Applications/mpv.app/Contents/MacOS/mpv
/Applications/mpv.app/Contents/MacOS/mpv
What about the ps+which commands (:
I reedited, please take a look.
Seems like ps -o comm= -p PID_HERE
would do the trick! Thanks for helping out.
Does the script work out of the box on the latest commit?
Yes
Weird thing, when hovering on the timeline, there's one more mpv icon popped up on dock, like this:
Weird thing, when hovering on the timeline, there's one more mpv icon popped up on dock, like this:
Is there a solution to this? Whenever thumbnails get generated playing any video in MacOS, I get 2 more MPV icons in dock. Kinda irritating.
Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue(Mac).
I've been able to set up a Mac VM and try this out. It doesn't even work out of the box, and the reason it doesn't generate extra icons is because it uses ffmpeg by default? I'll commit a solution that properly picks up on the symlink if the user made it.
Workaround:
ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin
Is there another way to fix this?