Clicking to Play with MPV does not work.
Werner1201 opened this issue · comments
I've installed ff2mpv and the native client but nothing seem to change that I can't make ff2mpv open any youtube video, but I can open them with mpv and the video link in the terminal.
I'm using Kubuntu 20.04 and I have mpv installed tthrough apt and youtube-dl through pip3.
I'm thinking it has some problem with the url it's receiving from Firefox. but I can't confirm since I don't know how to send a message to the addon. I'll try to change the python script to run with a fixed url to see if it works
I'll try to open a terminal with the python script to see if the sendNativeMessage is working
it seems like the python get message does not work.
SInce I can run it with mpv [youtube-link] in the ternimal I don't see why it does not work on the script
The Addon works with this video here video
just click play with mpv above the video
Bitchute doesn't work as well as liveleak. This sites I tested using the original python script
I found out that there's a permission problem with the way firefox is executing the python command and as consequence it causes yt_dl_hook to have permission problems. as demonstraded with the sudo command on the image
I'm not 100% sure what's happening here, but this sounds like a system configuration issue.
ff2mpv
itself does exactly one thing: it sends a message to the native client, which in turn is responsible for unpacking the message and executing mpv
. mpv
, in turn, needs to appropriately execute youtube-dl
, which is where the breakdown seems to be happening on your system. Firefox doesn't know or have any say over how youtube-dl
is executed.
If I had to guess, the issue might be that you're installing youtube-dl
into a system directory, hence the root permissions. Try removing it and using pip3 install --user youtube-dl
instead.
To phrase it better. I'm saying the opposite that you are claiming. My system does not need sudo to run the commands, the mpv [video_link
works fine in the terminal, the only thing that doesn't it's the execution of the comm inside the Python script. What I showed here is that it seems like the python script that is being ran by Firefox from ff2mpv is running the mpv command with privileges as I showed the yt-dl_hook error of permissions, and I showed that the only way in my system to get this yt-dl_hook error when running that command is by running with sudo, which indicates a permission problem with the Firefox running the command. That being said, I'll try the pip command to see if this fixes.
i'm going to to do a cold boot and see if this works
No change.
2020-12-26.09-11-11.mp4
What I showed here is that it seems like the python script that is being ran by Firefox from ff2mpv is running the mpv command with privileges as I showed the yt-dl_hook error of permissions, and I showed that the only way in my system to get this yt-dl_hook error when running that command is by running with sudo, which indicates a permission problem with the Firefox running the command.
Okay, now I understand. Thanks.
Could you give me the outputs to each of these commands?
which firefox mpv youtube-dl
stat firefox mpv youtube-dl
My current guess is that Firefox is running as another user, which means that the native client doesn't have youtube-dl
in its PATH
. That, or it's being run through a mechanism that doesn't start it through a login shell, which is where people usually put their PATH
modifications.
So, another question: how are you running Firefox?
What I showed here is that it seems like the python script that is being ran by Firefox from ff2mpv is running the mpv command with privileges as I showed the yt-dl_hook error of permissions, and I showed that the only way in my system to get this yt-dl_hook error when running that command is by running with sudo, which indicates a permission problem with the Firefox running the command.
Okay, now I understand. Thanks.
Could you give me the outputs to each of these commands?
which firefox mpv youtube-dl stat firefox mpv youtube-dl
Strangely enough stat doesn't give me anything with the program names
looks like firefox runs using root
only the youtube-dl is uid user
Strangely enough stat doesn't give me anything with the program names
Whoops, that was my fault. Looks like you figured it out, though.
only the youtube-dl is uid user
Those are just the file UID/GID, which don't necessarily reflect the process's runtime (E)UID and (E)GID. It makes sense that those two are owned by root
, since they're presumably installed by the system package manager.
Can you give me the result of this command, while running Firefox in the background?
ps aux | grep firefox
Also, just FYI: I get a separate notification every time you write a separate comment on this issue. If you can, please try to consolidate your comments so that this thread is less noisy/easier for others to cross-reference in the future.
Strangely enough stat doesn't give me anything with the program names
Whoops, that was my fault. Looks like you figured it out, though.
only the youtube-dl is uid user
Those are just the file UID/GID, which don't necessarily reflect the process's runtime (E)UID and (E)GID. It makes sense that those two are owned by
root
, since they're presumably installed by the system package manager.Can you give me the result of this command, while running Firefox in the background?
ps aux | grep firefox
Also, just FYI: I get a separate notification every time you write a separate comment on this issue. If you can, please try to consolidate your comments so that this thread is less noisy/easier for others to cross-reference in the future.
Okay, I'll try that command, And I'll consolidate the replies.
here's the result of the ps | grep command: (figured a text file would be more readable and grepable for you)
ps.txt
Okay, Firefox is definitely running as your user. So that's not the problem.
How exactly are you running Firefox? For example: are you clicking on an icon to start it, or are you running it through some sort of DE/WM launcher?
Okay. Two things, then:
- Try running Firefox from a terminal (just run
firefox
), and then try usingff2mpv
. - If the above works, try modifying your
.desktop
file to something like this:
Exec=bash -c "firefox %U"
...and let me know if that works.
So, I'm making a new reply because it seems to be a problem with the way the desktop links are put together that the %U parameter after the program command makes the program not work if run with bash -c
When it is without the default %U the addon works. I think this "bug" is related to zsh and the way it is handeling t%he execution of the programs on Kubuntu
EDIT
Nevermind All I said, %U is explained here To Drag a link to desktop ??? seems like it belongs to FIrefox but initializing the program with %U nullifies the addon for some reason.
May I also add that the command you gave me to add to the .desktop gives me that there's no '-c' command
Yep. Confirmed, I can make it work if I remove the %U command from the .desktop even without the bash -c there, this means it has some problem with this %U
May I add that my shell is zsh. Will it influence the result?
It shouldn't, but I don't know anything about zsh.
Yep. Confirmed, I can make it work if I remove the %U command from the .desktop even without the bash -c there, this means it has some problem with this %U
Just to clarify: you mean that ff2mpv
works without any other changes, as long as you remove %U
from your .desktop
file?
May I add that my shell is zsh. Will it influence the result?
It shouldn't, but I don't know anything about zsh.
Yep. Confirmed, I can make it work if I remove the %U command from the .desktop even without the bash -c there, this means it has some problem with this %U
Just to clarify: you mean that
ff2mpv
works without any other changes, as long as you remove%U
from your.desktop
file?
Yes that's what I meant. And I may add that the %U is from the Exec command that is already executed by kde
Oh I should also Add that trying to execute firefox via pure zsh only running firefox on the terminal does not allow the addon to work it only works with bash. Wierd... I see that the install script uses a BASH_SOURCE[0] variable, maybe that causes the problem ? I don't think it will because it's just getting the current directory.
Yes that's what I meant
Okay, that's a mystery to me. My understanding of %U
is that it's used for drag-and-drop operations with one or more URLs, so it shouldn't affect addons whatsoever.
In any case, it's Linux distro dumbness and therefore outside of the scope of ff2mpv
. I'll add some notes to the Wiki documenting it as a potential problem.
. My understanding of
%U
is that it's used for drag-and-drop operations with one or more URLs, so it shouldn't affect addons whatsoever.
Maybe It affects it because you communicate with outside programs ? with the message thing ?
In any case, it's Linux distro dumbness and therefore outside of the scope of
ff2mpv
. I'll add some notes to the Wiki documenting it as a potential problem.
Okay, Thanks for your patience. It kinda works and the %U doesn't really affect me very much.
Maybe It affects it because you communicate with outside programs ? with the message thing ?
Possibly, but that isn't documented anywhere. That would also break a whole bunch of other extensions (like password managers) that use the same mechanism, which is why it surprises me.
Okay, Thanks for your patience. It kinda works and the %U doesn't really affect me very much.
No problem. I've added some notes to the wiki reflecting your problem. Thanks for helping debug it.