aboutsummaryrefslogtreecommitdiff
path: root/scripts/load_every_help.sh
blob: 4bd5951d93cfd1e242d0387cd83dd9f091c358db (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

PD_ROOT=$1
NETRECEIVE_PATCH=/tmp/.____pd_netreceive____.pd
PORT_NUMBER=55555
LOG_FILE=/tmp/load_every_help-log-`date +20%y-%m-%d_%H.%M.%S`.txt

helpdir=${PD_ROOT}/doc
bindir=${PD_ROOT}/bin

function make_netreceive_patch () 
{
	 rm $1
	 touch $1
	 echo '#N canvas 222 130 454 304 10;' >> $1
	 echo "#X obj 111 83 netreceive $PORT_NUMBER 0 old;" >> $1
}

function open_patch ()
{
	 echo "OPENING: $1 $2" >> $LOG_FILE
	 echo "; pd open $1 $2;" | ${bindir}/pdsend $PORT_NUMBER localhost tcp
}

function close_patch ()
{
	 echo "CLOSING: $1" >> $LOG_FILE
	 echo "; pd-$1 menuclose;" | ${bindir}/pdsend $PORT_NUMBER localhost tcp
}



make_netreceive_patch $NETRECEIVE_PATCH

touch $LOG_FILE
${bindir}/pd -nogui -stderr -open $NETRECEIVE_PATCH >> $LOG_FILE 2>&1 &

#wait for pd to start
sleep 30

for file in `find $helpdir -name '*.pd'`; do
	 filename=`echo $file|sed 's|.*/\(.*\.pd\)$|\1|'`
	 dir=`echo $file|sed 's|\(.*\)/.*\.pd$|\1|'`
	 open_patch $filename $dir
	 sleep 1
	 close_patch $filename
done

echo "COMPLETED!" >> $LOG_FILE
echo "; pd quit;" | ${bindir}/pdsend $PORT_NUMBER localhost tcp