def main():
    if len(sys.argv) > 1:
        stream_name = sys.argv[1]
    else:
        stream_name = "main"

    try:
        player = subprocess.Popen(["mplayer", streams[stream_name]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    except __HOLE__:
        print("Usage: {} [station]".format(sys.argv[0]))
        print("Available stations: {}".format(", ".join(streams)))
        print("Default stream: main")
        sys.exit(1)
    except FileNotFoundError:
        print("You need to have mplayer to use radioreddit.")
        sys.exit(1)

    try:
        while not player.poll():
            player_line = player.stdout.readline().decode("utf-8")
            if player_line.startswith("ICY Info: "):
                song_name = re.match("ICY Info: StreamTitle='(.*?)';StreamUrl='';", player_line).group(1)
                print("New song! {}".format(song_name))
    except KeyboardInterrupt:
        player.kill()
    except Exception as e:
        print("Exception: {}".format(e))
dataset/ETHPy150Open gkbrk/radioreddit-cli/radioreddit-cli.py/main