#!/bin/bash
# check that we're recording locally
var=`socket_test_client localhost "status-record" 50080 | grep "recording to" | grep -c local`
newpath=`pwd`
if [ $var = 1 ]; then
newpath=`socket_test_client localhost "status-record" 50080 | grep "recording to" | sed 's/^.*\://' | sed 's/\s.*path\s/\//'`
cd $path
else
recv=`socket_test_client localhost "status-receiver" 50080 | grep -c "Receiving to"`
if [ $recv = 1 ]; then
dirname=`socket_test_client localhost "status-settings" 50080 | grep "Output directory:" | sed 's/^.*\:\s//'`
diskname=`socket_test_client localhost "status-receiver" 50080 | grep "Receiving to" | sed 's/^.*directory\s//' | sed 's/\,.*$//'`
newpath=$diskname/$dirname
fi
fi
cd $newpath