#!/usr/bin/env bash
# 
# SCRIPT NAME:
# twitch
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# This script loads a Twitch livestream in a local video player
# using streamlink.
#
# USAGE:
# ./twitch USERNAME [RESOLUTION]
if [[ -z $1 ]]; then
  echo "Please enter a username!"
  exit 1
fi

if [[ -z $2 ]]; then
  resolution="best"
else
  resolution="${2}"
fi

streamlink "https://twitch.tv/${1}"  "${resolution}"
