summaryrefslogtreecommitdiff
path: root/templates/bin/yle-dl
blob: fdaf8459fc6c57de4b1582ad24477a84afa4d9ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

# Downloads a video stream from Yle Areena to stdout using yle-dl
# script. The first parameter is the video page URL. Second parameter
# is the output file (optional).

YLEDL=yle-dl

which $YLEDL > /dev/null 2>&1
if [ $? != 0 ]; then
    echo "ERROR: $YLEDL is not on \$PATH" 1>&2
    echo "Install rtmpdump-yle from http://users.tkk.fi/~aajanki/rtmpdump-yle/index.html" 1>&2
    exit 1
fi

if [ "x$1" = "x" ]; then
    echo "Expected Areena URL as parameter" 1>&2
    exit 1
fi

OUTFILE="$2"
if [ "x$OUTFILE" = "x" ]; then
    OUTFILE=-
fi

$YLEDL $1 -q -o "$OUTFILE"

exit $?