Skip to content

Instantly share code, notes, and snippets.

@cirrusUK
Created March 3, 2020 19:44
Show Gist options
  • Save cirrusUK/2976c46c15ea2996ccbc517347e26c41 to your computer and use it in GitHub Desktop.
Save cirrusUK/2976c46c15ea2996ccbc517347e26c41 to your computer and use it in GitHub Desktop.
shell script which uses streamlink's tvplayer plugin to peruse live UK TV channels. ๐Ÿ“บ
#!/bin/sh
#This script requires streamlink,mpv, pipe viewer (pv) & toilet.
#Uses streamlink's tvplayer plugin to peruse UK TV channels.๐Ÿ“บ
# Some streams require login to https://tvplayer.com use flags below to authenticate
#streamlink -p mpv 'https://foo' best --tvplayer-email your@mail --tvplayer-password yourpasswd
# (1) prompt user, and read command line argument.๐Ÿ“ก
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
printf %"s\n"
printf %"s\n"
tput setaf 3
blue=`tput setaf 4`
echo -e "\e[0;36m๐Ÿ“ก \e[0;31m๐ŸŽฅ \e[0;32m๐Ÿ“บ \e[0;33m๐Ÿ“บ \e[0;34m๐Ÿ“บ \e[0;39m๐Ÿ“บ \e[0;38m๐Ÿ“บ \e[0;35m๐Ÿ“บ \e[0;37m๐Ÿ“บ \e[0;33m๐ŸŽฅ \e[0;39m๐Ÿ“ก \e[0m\n"
toilet -f future --metal ' TV Player'
tput setaf 2
printf %"s\n"
printf '\E[33m'" Enter number/letter of desired\n channel,sit back & enjoy" | pv -qL 15 ;
sleep 1
echo ''
echo ''
tput setaf 4
read -p "1= lawandcrime
2= 4seven
3= 5star
4= bbcfour
5= bbcnews
6= bbcone
7= bbctwo
8= boxnation
9= cbbc
0= channel4
A= cheddar
B= crime&investigation
C= discovery
D= dmax
E= facsinationtv
F= five
G= foodnetwork
H= h2
I= hgtv
J= historyhd
K= itv3
L= itv4
M= itvbe
N= law+crime
O= lifetime
P= more4
R= quest
S= questred
T= really
U= tlc
#
`tput setaf 2`
Q= Exit
`tput setaf 1`
PLay=: " answer
tput setaf 2
echo "You entered: $answer"
tput setaf 3
# (2) handle the command line argument we were given
while true
do
case $answer in
[1]* ) echo "Playing Law & Crime ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/lawandcrime' 576p
break;;
[2]* ) echo "Playing 4Seven ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/4seven' 576p
break;;
[3]* ) echo "Playing 5 Star ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/5star' 576p
break;;
[4]* ) echo "Playing BBC 4 ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/bbcfour' 576p
break;;
[5]* ) echo "Playing BBC News ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/bbcnews' 576p
break;;
[6]* ) echo "Playing BBC One ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/bbcone' 576p
break;;
[7]* ) echo "Playing BBC Two ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/bbctwo' 576p
break;;
[8]* ) echo "Playing Box Nation ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/boxnation' 576p
break;;
[9]* ) echo "Playing CBBC ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/cbbc' 576p
break;;
[0]* ) echo "Playing Channel Four ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/channel4' 576p
break;;
[Aa]* ) echo "Playing Cheddar ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/cheddar' 576p
break;;
[Bb]* ) echo "Playing Crime & Investigation ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/crime&investigation' 576p
break;;
[Cc]* ) echo "Playing Discovery ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/discovery' 576p
break;;
[Dd]* ) echo "Playing DMAX ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/dmax' 576p
break;;
[Ee]* ) echo "Playing Fascination TV ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/fascinationtv' 576p
break;;
[Ff]* ) echo "Playing Five ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/five' 576p
break;;
[Gg]* ) echo "Playing Foodnetwork ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/foodnetwork' 576p
break;;
[Hh]* ) echo "Playing H2 ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/h2' 576p
break;;
[Ii]* ) echo "Playing HGTV ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/hgtv' 576p
break;;
[Jj]* ) echo "Playing History HD" && streamlink -p mpv 'https://tvplayer.com/watch/historyhd' 576p
break;;
[Kk]* ) echo "Playing ITV 3 ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/itv3' 576p
break;;
[Ll]* ) echo "Playing ITV 4 ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/itv4' 576p
break;;
[Mm]* ) echo "Playing ITVbe ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/itvbe' 576p
break;;
[Nn]* ) echo "Playing Law & Crime ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/lawandcrime' 576p
break;;
[Oo]* ) echo "Playing Lifetime" && streamlink -p mpv 'https://tvplayer.com/watch/lifetime' 576p
break;;
[Pp]* ) echo "Playing More 4 ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/more4' 576p
break;;
[Rr]* ) echo "Playing Quest ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/quest' 576p
break;;
[Ss]* ) echo "Playing Quest Red ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/questred' 576p
break;;
[Tt]* ) echo "Playing Really ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/really' 576p
break;;
[Uu]* ) echo "Playing TLC ๐Ÿ“บ" && streamlink -p mpv 'https://tvplayer.com/watch/tlc' 576p
break;;
[Qq]* ) exit;;
* ) echo -e "Goodbye, do call again."
break ;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment