Add `rdbl-luks`, git textconv diff filter for LUKS headers
[sunny256-utils.git] / radiolagring
blob50ddf87cd4730c8a3fe71cbde4ef4c73f9d67498
1 #!/usr/bin/env bash
3 # radiolagring
4 # File ID: 011d0820-fa5d-11dd-a357-0001805bf4b1
5 # Syntax: radiolagring navn kanal lengde
7 export PATH=$HOME/bin:$HOME/bin/basnakk:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/games
9 navn=$1
10 kanal=$2
11 lengde=$3
13 dlfile=`u`.$navn.nrk_$kanal.mp3
14 uuid=`suuid -t radiolagring_begin --raw -w eo -c "<c_radiolagring w=\"begin\"> <name>$navn</name> <channel>$kanal</channel> <length>$lengde</length> <filename>$dlfile</filename> </c_radiolagring>"` || { echo "radiolagring: IMPORTANT - suuid error, but will continue" >&2; }
15 dldir=$HOME/dl/nettradio
16 logdir=$HOME/log/radiolagring
17 logfile=$logdir/$uuid.wgetlog
19 [ -d $logdir/. ] || mkdir -p $logdir || { echo "$0: $logdir: Klarte ikke mkdir" >&2; exit 1; }
20 timeout $[60*$lengde] wget -U "xmms/1.2.7" -o $logfile -O $dldir/$dlfile http://radio.hiof.no:8000/nrk-$kanal-128
21 smsum=`smsum <$dldir/$dlfile`
22 mtime=`TZ=UTC find "$dldir/$dlfile" -printf "%TY-%Tm-%TdT%TH:%TM:%TSZ"`
23 suuid -w o -t radiolagring_end --raw -c "<c_radiolagring w=\"end\"> <finished>$uuid</finished> <file> <name>$dlfile</name> <smsum>$smsum</smsum> <mtime>$mtime</mtime> </file> </c_radiolagring>"
24 gzip -q $logfile