29 lines
680 B
Bash
29 lines
680 B
Bash
#!/usr/bin/env sh
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
for i in `seq 1 $(cat $FAV_STREAMERS | wc -l)`
|
|
do
|
|
streamer="$(sed "$i q;d" $FAV_STREAMERS)"
|
|
|
|
if [ "$(youtube-dl -e "https://www.twitch.tv/$streamer" 2>/dev/null)" ]
|
|
then
|
|
online_streamers="$online_streamers\n$streamer"
|
|
fi
|
|
done
|
|
|
|
first_line="$(printf "%b\n" "$online_streamers" | sed "1q;d")"
|
|
if [ -z $first_line ]; then
|
|
online_streamers="$(printf "%b\n" $online_streamers | sed "1d")"
|
|
fi
|
|
|
|
watch="$(printf "%b\n" "${online_streamers}" | rofi -dmenu -p "Streamer name")"
|
|
|
|
else
|
|
|
|
watch="$1"
|
|
|
|
fi
|
|
|
|
[ -n "$watch" ] && mpv $MPV_FLAGS "https://www.twitch.tv/$watch"
|