Script to watch twitch, YAY!

This commit is contained in:
inigoortega 2019-09-14 21:11:40 +02:00
parent 9f81b8369e
commit 2f95874a9c
4 changed files with 25 additions and 0 deletions

View File

@ -19,6 +19,7 @@ export BRIGHTNESS="0.9"
export SUDO_ASKPASS="/usr/bin/x11-ssh-askpass"
export TRASH="$HOME/.local/trash:$HOME/.local/share/vifm/Trash"
export DEVICES_FOLDER="/media"
export FAV_STREAMERS="$HOME/fav_streamers"
export LC_ALL=en_US.utf8
# custom prompt see http://comments.gmane.org/gmane.os.miros.mksh/126

View File

@ -20,4 +20,5 @@ export BRIGHTNESS="0.9"
export SUDO_ASKPASS="/usr/bin/x11-ssh-askpass"
export TRASH="$HOME/.local/trash:$HOME/.local/share/vifm/Trash"
export DEVICES_FOLDER="/media"
export FAV_STREAMERS="$HOME/fav_streamers"
export LC_ALL=en_US.utf8

1
.zshrc
View File

@ -101,6 +101,7 @@ export BRIGHTNESS="0.9"
export SUDO_ASKPASS="/usr/bin/x11-ssh-askpass"
export TRASH="$HOME/.local/trash:$HOME/.local/share/vifm/Trash"
export DEVICES_FOLDER="/media"
export FAV_STREAMERS="$HOME/fav_streamers"
export LC_ALL=en_US.utf8
#

22
scripts/watch-twitch.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
fav_streamers="$(cat $FAV_STREAMERS)"
for i in `seq 1 $(echo "$fav_streamers" | wc -l)`
do
streamer="$(echo "$fav_streamers" | sed "$i q;d")"
if [ "$(youtube-dl -e "https://www.twitch.tv/$streamer" 2>/dev/null)" ]
then
online_streamers="$online_streamers\n$streamer"
fi
done
first_line="$(echo "$online_streamers" | sed "1q;d")"
if [ -z $first_line ]; then
online_streamers="$(echo $online_streamers | sed "1d")"
fi
watch="$(echo "$online_streamers" | rofi -dmenu -p "Streamer name")"
[ -n "$watch" ] && mpv "https://www.twitch.tv/$watch"