viewtube.sh
------------------------------------------------------------------------------------------------------------------
#! /bin/bash
s="$(echo "$1" | sed -e "s/viewtube://")"
v="$(echo "$s" | awk -F '|' '{print $1}')"
a="$(echo "$s" | awk -F '|' '{print $2}')"
if [ "$a" = "" ]; then
mpv --osc --fs --ytdl=yes "$v"
#cvlc -f "$v"
else
mpv --osc --fs --ytdl=yes --audio-file "$a" "$v"
#cvlc -f --input-slave "$a" "$v"
fi
------------------------------------------------------------------------------------------------------------------
3.2 Create the viewtube protocol file in ~/.local/share/applications
viewtube.desktop
Enable protocol:
Test:
src:http://sebaro.pro/viewtube/?ln=en
------------------------------------------------------------------------------------------------------------------
#! /bin/bash
s="$(echo "$1" | sed -e "s/viewtube://")"
v="$(echo "$s" | awk -F '|' '{print $1}')"
a="$(echo "$s" | awk -F '|' '{print $2}')"
if [ "$a" = "" ]; then
mpv --osc --fs --ytdl=yes "$v"
#cvlc -f "$v"
else
mpv --osc --fs --ytdl=yes --audio-file "$a" "$v"
#cvlc -f --input-slave "$a" "$v"
fi
------------------------------------------------------------------------------------------------------------------
3.2 Create the viewtube protocol file in ~/.local/share/applications
viewtube.desktop
[Desktop Entry]
Name=ViewTube Protocol
Exec=/path/to/viewtube.sh %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/viewtube
Name=ViewTube Protocol
Exec=/path/to/viewtube.sh %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/viewtube
Enable protocol:
xdg-mime default viewtube.desktop x-scheme-handler/viewtube
Test:
xdg-open viewtube:http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
src:http://sebaro.pro/viewtube/?ln=en