Thann / play-with-mpv

Chrome extension that allows you to play videos in webpages like youtube with MPV instead
https://chrome.google.com/webstore/detail/play-with-mpv/hahklcmnfgffdlchjigehabfbiigleji
The Unlicense
348 stars 80 forks source link

auto-start isn't working #55

Closed jvschiavo closed 3 years ago

jvschiavo commented 3 years ago

I'm having trouble with auto-start, it isn't working. Could I get some help?

I followed the instructions here in this github. This log might have some relevant information:

my_user@pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20.1
Release:    20.1
Codename:   ulyssa
my_user@pc:~$ uname -a
Linux pc 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
my_user@pc:~$ whereis play-with-mpv
play-with-mpv: /home/my_user/.local/bin/play-with-mpv
my_user@pc:~$ ls /usr/share/applications/ | grep ^th
thunar-bulk-rename.desktop
thunar.desktop
thunar-settings.desktop
thunar-volman-settings.desktop
thunderbird.desktop
my_user@pc:~$ ls -l ~/.local/share/applications/thann.play-with-mpv.desktop
-rwxrwxr-x 1 my_user my_user 310 mai 13 21:46 /home/my_user/.local/share/applications/thann.play-with-mpv.desktop
my_user@pc:~$ ls -l ~/.local/bin/play-with-mpv 
-rwxrwxr-x 1 my_user my_user 214 mai 13 21:46 /home/my_user/.local/bin/play-with-mpv
my_user@pc:~$ ls -l ~/.config/autostart/thann.play-with-mpv.desktop 
-rwxrwxr-x 1 my_user my_user 310 mai 13 21:51 /home/my_user/.config/autostart/thann.play-with-mpv.desktop
my_user@pc:~$ diff ~/.local/share/applications/thann.play-with-mpv.desktop ~/.config/autostart/thann.play-with-mpv.desktop 
my_user@pc:~$ cat ~/.config/autostart/thann.play-with-mpv.desktop 
#!/usr/bin/env xdg-open
[Desktop Entry]
Categories=AudioVideo;Audio;Video;Player;TV
Comment=Chrome extension and python server that allows you to play videos in webpages with MPV instead.
Exec=/play_with_mpv-0.1.0.post9+g07a9c1d.data/scripts/play-with-mpv
Icon=mpv
Name=Play With MPV (server)
Type=Application
jvschiavo commented 3 years ago

Nevermind, I managed to fix this thanks to https://github.com/Thann/play-with-mpv/issues/20

I deleted the shebang line (not sure if this was needed) and fixed the correct Exec path.

jvschiavo commented 3 years ago

Now it isn't autostarting anymore. I have no idea why. :/

Chaostheorie commented 3 years ago

Any logs or versions you might be able to supply? Maybe it tries to listen on an already used port or sth.

jvschiavo commented 3 years ago

Ok, it started working again... I'm not sure why. I think that when I checked before I was looking for the term "thann" in htop (to see if it was running) when the process name was actually "play-with-mpv". Not sure though why it wasn't working that time.

Maybe I should close the issue for now until I have another problem like this? Or do you think some kind of information might be useful right now?

Chaostheorie commented 3 years ago

Good to hear, that you problem has been resolved. As long as it works and you can't replicate the problem anymore, you can close the issue. Just reopen it, if you find a reproducible problem later on.

bheeshmpita commented 2 years ago

Good to hear, that you problem has been resolved.

@Thann @Chaostheorie Hi there, I am facing issue with it , opened issue #62 i cant find play-with-mpv executable file according to the location mentioned in desktop file. so I was thinking to place the required files via zip download. I'm a beginner in Linux, need your help. thanks

Chaostheorie commented 2 years ago

@bheeshmpita if you have installed it with pip (via pip install git+git://github.com/thann/play-with-mpv --user) you will need to add pip's location for executables in the PATH (PATH is a list of directories where your shell looks when searching for executables) too. If you haven't done this step yet, refer to this SO answer.

Otherwise, please try to locate the binary (i.e., locate play-with-mpv) and add the found DIR to `PATH. In case it finds nothing, please provide information about your OS and open a separate issue.

bheeshmpita commented 2 years ago

@Chaostheorie

refer to this SO answer.

though the answer is brief still I cant apprehend it. this is how my ~/.profile looks.

`# ~/.profile: executed by the command interpreter for login shells.

This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login

exists.

see /usr/share/doc/bash/examples/startup-files for examples.

the files are located in the bash-doc package.

the default umask is set in /etc/profile; for setting the umask

for ssh logins, install and configure the libpam-umask package.

umask 022

if running bash

if [ -n "$BASH_VERSION" ]; then

include .bashrc if it exists

if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi

fi

set PATH so it includes user's private bin if it exists

if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi

set PATH so it includes user's private bin if it exists

if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi `

locate play-with-mpv

i tried this and it listed only contents in the zip i downloaded in order to place at the missing executable file. Can I do it with zip?

Chaostheorie commented 2 years ago

@bheeshmpita Okay. Then a full on guide with the ZIP. Since if [ -d "$HOE/.local/bin … is in your profile, we can just use the existing ~/.local/bin/ dir.

Assumes you have gotten the source code zip from the releases page in your current dir (i.e. Downloads/). If you need to go to that dir use cd <dir>

Two paths are now open:

To run the server:

bheeshmpita commented 2 years ago

@Chaostheorie

Two paths are now open: Either Install with pip (highly recommended): python3 -m pip install .

does this command be executed after moving into a specific folder ie cd in the terminal?

Chaostheorie commented 2 years ago

@bheeshmpita Yes after the previous cd command. The commands are meant to be run on after another in the same terminal. This means you start by opening a terminal, navigating to the DIR where the zip is placed, unzip it, and enter the newly created folder. At this point you can choose to either install with pip, i.e., python3 -m pip install ., or move the file directly mv play_with_mpv.py ~/.local/bin/.

bheeshmpita commented 2 years ago

@Chaostheorie it seems there is problem in python script in the zip. following was the output

abhi@hdd-bodhi-linux:~/.local/bin$ play_with_mpv.py File "/home/abhi/.local/bin/play_with_mpv.py", line 96 print(f"ERROR: {bin.upper()} does not appear to be installed correctly! please ensure you can launch '{bin}' in the terminal.") ^ SyntaxError: invalid syntax

Chaostheorie commented 2 years ago

Change the first line of the script from #!/usr/bin/env python to #!/usr/bin/env python3. This error occurs since the script uses python3.8 syntax, and you seem to have python version 2 set as default.

(Note: to edit a file either use nano (i.e. nano ~/.local/bin/play_with_mpv.py, edit, and save and exit with Ctrl+O) or your favourite text editor)

bheeshmpita commented 2 years ago

@Chaostheorie THANK YOU so much brother. it worked. does this extension have any automated command to play with mpv or does it have to be done by user always? Thanks again

Chaostheorie commented 2 years ago

@bheeshmpita Your welcome. I'm not aware of any automatic way of playing videos on page load, but there's already an issue (#31) for this feature open.