audiod: always dump the audio status
[paraslash.git] / scripts / demo-script
1 #!/bin/bash
2
3 bin="para_client para_audioc para_audiod para_gui" # the binaries we need
4 log="`pwd`/demo-log.$$.log"
5 dir="$HOME/.paraslash"
6 client_conf="$dir/client.conf"
7 audioc_conf="$dir/audioc.conf"
8 server=www.paraslash.org
9 proj=paraslash-0.2.12
10 df=$proj.tar.bz2 # download file
11 url=http://$server/versions/$df
12 kf="$dir/key.anonymous" # key file
13 key_url=http://$server/key.anonymous
14 socket="$dir/socket"
15 receiver_opts="mp3:http -i $server -p 8009"
16 audiod_log="$dir/audiod.log"
17 audiod_opts="-FDd -L $audiod_log -s $socket"
18 msg()
19 {
20         echo "`date`: $1"
21 }
22
23 go()
24 {
25         msg "downloading $df"
26         wget -N -q $url || return 1
27         msg "decompressing"
28         rm -rf $proj; tar xjf $df
29         cd $proj || return 1
30         msg "configuring (be patient, ignore warnings but not errors)"
31         ./configure --prefix "$HOME" >> "$log"
32         msg "building $bin"
33         make $bin >> "$log"
34         msg "installing"
35         mkdir -p $HOME/bin && install -c -s -m 755 $bin $HOME/bin || return 1
36         export PATH=$HOME/bin:$PATH
37         msg "retrieving anonymous key"
38         mkdir -p $dir || return 1
39         wget -q --directory-prefix=$dir $key_url || return 1
40         msg "writing $client_conf"
41         cat << EOF > "$client_conf"
42                 user "anonymous"
43                 hostname "$server"
44                 key_file "$kf"
45 EOF
46         msg "writing $audioc_conf"
47         echo "socket \"$socket\"" > "$audioc_conf"
48         (para_audioc term; killall para_audiod para_client) >> "$log" 2>&1
49         msg "para_audiod $audiod_opts -r '$receiver_opts'"
50         para_audiod $audiod_opts -r "$receiver_opts" -w "mp3:mpg123 -"
51         echo "hit return to start para_gui, hit ctrl+c to abort"
52         read
53         para_gui
54 }
55
56 go