Update bash_prompt
[config/bash.git] / .bash / aliases.d / rai-play
1 #!/bin/bash
2
3 if command -v jq &> /dev/null && command -v gst-launch-1.0 &> /dev/null;
4 then
5   function rai-play()
6   {
7     [ "x$1" = "x" ] && return 1;
8
9     local BANDWIDTH="2479000"
10     local CONTENT_URL
11
12     CONTENT_URL=$(wget -q "${1}?json" -O - | jq -r '.video .contentUrl')
13     if [ "x$CONTENT_URL" != "x" ];
14     then
15       gst-launch-1.0 playbin connection-speed="$BANDWIDTH" uri="$CONTENT_URL"
16     fi
17   }
18 fi