summaryrefslogtreecommitdiffstats
path: root/.local/bin/youtube-kodi
blob: 7d277e6f7c474aa512314fb780407c3aea67370c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

if (pidof kodi.bin);
then
	address=127.0.0.1
else
	address=$(grep htpc -A3 "$HOME/.ssh/config" | awk '/Hostname/ {print $2}')
fi

if [ -z "$1" ]
then
	kodi-send --host="$address" -a "PlayPause"
else
	url=$(yt-dlp -f b -g --no-playlist "$1")
	kodi-send --host="$address" -a "PlayMedia($url,[noresume])"
fi