antoniy / mpv-youtube-dl-binding

94 stars 20 forks source link

%url variable #13

Closed eoli3n closed 8 years ago

eoli3n commented 9 years ago

Hi,

I use xclip and xbindkeys to create a playlist and play it through mpv. It allows using mpv like autoplaying function of youtube.com.

"DISPLAY=:0 curl -s $(xclip -o) | grep 'watch?v=' | cut -d'"' -f2 | grep 'watch?v=' | uniq | sed 's-/watch-http://www.youtube.com/-' > ~/movs/youtube/tmp && mpv --playlist ~/movs/youtube/tmp

But it's boring to select url before making key combination. With your plugin, i could just load url, and clic on the plugin button.

For that, i need to be able to paste that line in your plugin conf

"DISPLAY=:0 curl -s $(%url) | grep 'watch?v=' | cut -d'"' -f2 | grep 'watch?v=' | uniq | sed 's-/watch-http://www.youtube.com/-' > ~/movs/youtube/tmp && mpv --playlist ~/movs/youtube/tmp

Or something like that.

Is it possible to set a variable with current youtube url ?

Thx, bye

antoniy commented 8 years ago

Pushed a new version which adds this feature. You can now use %%url%% placeholder in parameters and pass it to your custom script instead of mpv executable to trigger your logic.

Regards

eoli3n commented 8 years ago

Re,

I created a script -rwxr-xr-x 1 root root 238 26 nov. 11:49 mpv.sh

#!/bin/bash
echo $1 > /tmp/mpv_playlist
curl -s $1 | grep 'watch?v=' | cut -d'"' -f2 | grep 'watch?v=' | uniq | sed 's-/watch-http://www.youtube.com/-' >> /tmp/mpv_playlist
DISPLAY=:0 mpv --playlist /tmp/mpv_playlist
rm /tmp/mpv_playlist

When i try

/usr/bin/mpv.sh https://www.youtube.com/watch?v=fMl0pNy7g2Q

It works so i tried to put in your conf :

1° Native player location : /usr/bin/mpv.sh Additional player parameters : %%url%% Did not work 2° Native player location : /usr/bin/mpv.sh %%url%% Did not work too.

What did I miss ?

Thx for your help.

antoniy commented 8 years ago

The %%url%% placeholder should be placed in the Additional player parameters and it will be passed as expected by your script. The Native player location field is just to specify the executable.

Have you updated the plugin to the latest version?

eoli3n commented 8 years ago

But it didnt work, see "1°", maybe your tool dont pass it as $1 in bash execution ?