po5 / thumbfast

High-performance on-the-fly thumbnailer script for mpv
Mozilla Public License 2.0
861 stars 35 forks source link

Flatpak, Snap, AppImage #54

Closed po5 closed 1 year ago

po5 commented 1 year ago

Need to investigate what problems may arise on Linux systems with weirdo self-contained package formats.
Do they even allow user scripts?
Would the Mac PID lookup be enough? (I know it does work with regular mpv on Linux)

eko5624 commented 1 year ago

Weird thing, when hovering on the timeline, there's one more mpv icon popped up on dock, like this:

QQ20221030-133833@2x

Originally posted by @eko5624 in https://github.com/po5/thumbfast/issues/48#issuecomment-1296119756

po5 commented 1 year ago

Please try the mac-test and mac-test2 branches.

mac-test launches the thumbnailer instance as an "accessory" (whatever that is). I'm worried it will create an icon in some other menu than the dock.
mac-test2 has "app-activation-policy" set to "prohibited", probably the safer option if this also doesn't show up in the dock.

Do both hide the icon? Let me know.

eko5624 commented 1 year ago

when hovering on the timeline: mac-test:2 icons on dock. mac-test2: 2 icons on dock too.

hooke007 commented 1 year ago

It seems to be a bundle-app's quirk. The mpv installed by brew won't show the second icon even though without patch.

qwerty12 commented 1 year ago

Both mac-test and mac-test2 work here at least (you see the additional Dock icon for a split second before mpv works its macos_app_activation_policy magic) with this simple change:

diff --git a/thumbfast.lua b/thumbfast.lua
index c395394..74b4e2f 100644
--- a/thumbfast.lua
+++ b/thumbfast.lua
@@ -193,6 +193,7 @@ local mpv_path = "mpv"

 if os_name == "Mac" and unique then
     mpv_path = string.gsub(mp.command_native({name = "subprocess", playback_only = false, capture_stdout = true, args = {"ps", "-o", "comm=", "-p", tostring(unique)}}).stdout, "[\n\r]", "")
+    mpv_path = string.gsub(mpv_path, "/mpv%-bundle$", "/mpv")
 end

 local function vf_string(filters, full)

mpv 0.34.1 from https://laboratory.stolendata.net/~djinn/mpv_osx/ running on macOS 13.

hooke007 commented 1 year ago

Wow, Indeed.

po5 commented 1 year ago

@eko5624 Does the extra dock icon disappear on latest master?

Also hoping I didn't introduce more problems when adding support for mpv 0.29.0 :^)

eko5624 commented 1 year ago

@po5 Yes, the extra dock icon disappears. But when hovering on the timeline firtst time, the dock shaked, then back to normal.

https://user-images.githubusercontent.com/84926938/199141882-ab88e4f1-f1b0-47aa-8058-87772321412f.mp4

hooke007 commented 1 year ago

But when hovering on the timeline firtst time, the dock shaked, then back to normal.

Nothing we could fix mac's (or mpv's) "bug" here. I have no idea...

And I found that we don't need --macos-app-activation-policy=prohibited any more.

eko5624 commented 1 year ago

So I rollback to https://github.com/po5/thumbfast/commit/eb21b2e871144a328f93c4597cc1932b43783e6a temporarily, and set ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin , everything looks perfect.

po5 commented 1 year ago

everything looks perfect.

And you have no extra dock icon? Try latest commit.

hooke007 commented 1 year ago

https://github.com/po5/thumbfast/issues/48#issuecomment-1295959872 By this way icon would quickily show and then disappear too. But I cannot work out why “set ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin“ doesn’t show.

eko5624 commented 1 year ago

everything looks perfect.

And you have no extra dock icon? Try latest commit.

Latest commit is same as https://github.com/po5/thumbfast/commit/cbf01080bed8c13da7cdffa8d2c627ec9383cf87 , extra dock icon quickly show , then disappeared.
But https://github.com/po5/thumbfast/commit/eb21b2e871144a328f93c4597cc1932b43783e6a just only set ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin , no extra dock icon, no extra mpv icon quickily show and then disappeared, everything runs perfect.

po5 commented 1 year ago

We'll have to check if the mpv command is available for those who bothered to make a symlink, and fall back to the current code otherwise.

LampPrinter commented 1 year ago

eb21b2e

This is the only thing that worked for me too. I am on Apple Silicon M1 Mac. I did sudo ln -s /Applications/mpv.app/Contents/MacOS/mpv /opt/homebrew/bin/

When using the latest thumbnail.lua, the MPV icon would briefly show up and close. Annoyingly, you can still see it recent apps section. When using https://github.com/po5/thumbfast/commit/eb21b2e871144a328f93c4597cc1932b43783e6a thumbail.lua, icon doesn't pop up anymore

LampPrinter commented 1 year ago

I spoke soon. I am getting black thumbnails now with https://github.com/po5/thumbfast/commit/eb21b2e871144a328f93c4597cc1932b43783e6a thumbnail.lua. Using latest version and I get another icon briefly pop up in dock.

eko5624 commented 1 year ago

We'll have to check if the mpv command is available for those who bothered to make a symlink, and fall back to the current code otherwise.

Is there any progress?

po5 commented 1 year ago

It turns out libmpv players can support encoding mode, haven't tried it out yet but this exists: https://github.com/tsl0922/ImPlay/commit/f548e7387e37d98c4f13b3d120ff0d795e00f4c2

Can probably get @stax76 to implement it as well, and frontend users will be happy (:

hooke007 commented 1 year ago

Can probably get @stax76 to implement it as well

https://github.com/mpvnet-player/mpv.net/issues/387

po5 commented 1 year ago

Flatpak: works, stores config in a special directory.
AppImage: works, uses regular mpv config path.
Snap: probably works? stores config in a special directory.

The only snap that would give me graphical output was mpv-nilsboy with lots of error messages everywhere because it's very old.
Thumbnails would display with wacky colors.
I did do a theoretical test with mpv-wayland, and despite not being able to see it with my own eyes, everything indicates it works.

I think we've overcome the Mac issues too, solved.

eko5624 commented 1 year ago

To get rid of the shaking, make sure the app is in your Applications folder, then run: sudo ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/mpv

Doesn't work, shaking still exists.

po5 commented 1 year ago

Did you run this command? It's a different path from what you were doing, your previous symlink won't be taken into account.
If it still doesn't work, are you using the stolendata builds? On what MacOS version?

eko5624 commented 1 year ago

My fault, sudo ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/mpv this command works, thanks.