From: John F. <jo...@us...> - 2011-05-20 09:02:08
|
Update of /cvsroot/ingex/ingex/studio/scripts In directory vz-cvs-4.sog:/tmp/cvs-serv3276 Modified Files: startIngex_kde4.sh Log Message: No longer using d-bus Index: startIngex_kde4.sh =================================================================== RCS file: /cvsroot/ingex/ingex/studio/scripts/startIngex_kde4.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** startIngex_kde4.sh 16 May 2011 09:39:21 -0000 1.4 --- startIngex_kde4.sh 20 May 2011 09:02:06 -0000 1.5 *************** *** 139,142 **** --- 139,143 ---- DB_PARAMS="--dbhost $DB_HOST --dbname $DB_NAME --dbuser $DB_USER --dbpass $DB_PASS" + # allow KDE apps to work properly over the network export $(dbus-launch) *************** *** 162,166 **** while sudo killall -q -0 -e ${PROC} do ! usleep 100000 done fi --- 163,167 ---- while sudo killall -q -0 -e ${PROC} do ! usleep 100000 done fi *************** *** 233,289 **** # start a new konsole window ! konsole # find the pid of the new window ! PID=$(pidof ${ARGS} konsole) - capture_window="org.kde.konsole-${PID}" #echo "New Window is $capture_window..." # save PID ! echo ${PID} >> ${KONSOLE_PIDS} # seem to need this to allow things to settle! ! sleep 1 # move/resize the window in pixels #qdbus $capture_window /konsole/MainWindow_1 \ # org.freedesktop.DBus.Properties.Set com.trolltech.Qt.QWidget geometry 0,0,1024,344 ! echo "Started konsole $capture_window..." ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.currentSession) # set the required script path to all sessions if [ $CAPTURE -ge 1 ] ; then ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 "Capture" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $capture_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! echo "tab=$tab" if [ $CAPTURE_PROGRAM = "DVS_SDI" ] ; then # sudo nice -10 ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./dvs_sdi -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' elif [ $CAPTURE_PROGRAM = "DVS_DUMMY" ] ; then ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./dvs_dummy -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' elif [ $CAPTURE_PROGRAM = "BMD_ANASDI" ] ; then ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./bmd_anasdi -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' elif [ $CAPTURE_PROGRAM = "TESTGEN" ] ; then ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./testgen -c $CAPTURE_CHANNELS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' else echo "Invalid ingex.conf or argument. exit." return 1 fi - tab= fi # ** multicasting ** if [ $MULTICAST -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi # Prepare options. If mpeg transport stream, set -t option and bitrate if [ $MULTICAST_MPEG_TS -ge 1 ] ; then --- 234,296 ---- # start a new konsole window ! #export $(dbus-launch) ! #konsole # find the pid of the new window ! #PID=$(pidof ${ARGS} konsole) #echo "New Window is $capture_window..." # save PID ! #echo ${PID} >> ${KONSOLE_PIDS} # seem to need this to allow things to settle! ! #sleep 1 # move/resize the window in pixels #qdbus $capture_window /konsole/MainWindow_1 \ # org.freedesktop.DBus.Properties.Set com.trolltech.Qt.QWidget geometry 0,0,1024,344 ! #echo "Started konsole $capture_window..." ! ! function SetupTab { # arg: name of tab ! RC_FILE=/tmp/ingex-$1-bashrc ! echo "title: $HOSTNAME $1;; command: bash --rcfile $RC_FILE" >> $KONSOLE_TABS_FILE ! HISTORY=~/.ingex-$1-bash-history # don't put in /tmp as this won't be read until capture process finishes? ! rm $HISTORY 2>/dev/null ! echo "HISTFILE=$HISTORY" > $RC_FILE ! } ! ! function WriteCommand { #arg: command ! echo "echo $1" >> $RC_FILE ! echo $1 >> $RC_FILE ! echo $1 >> $HISTORY ! } ! ! KONSOLE_TABS_FILE=/tmp/ingex-tabs # the file given to the konsole command, containing tab names and a command to be executed for each tab, which only seems to work as a single word, so each points to an executable file ! rm $KONSOLE_TABS_FILE 2>/dev/null # set the required script path to all sessions if [ $CAPTURE -ge 1 ] ; then ! SetupTab "Capture" ! WriteCommand "cd $capture_path" if [ $CAPTURE_PROGRAM = "DVS_SDI" ] ; then # sudo nice -10 ! WriteCommand "./dvs_sdi -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" elif [ $CAPTURE_PROGRAM = "DVS_DUMMY" ] ; then ! WriteCommand "./dvs_dummy -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" elif [ $CAPTURE_PROGRAM = "BMD_ANASDI" ] ; then ! WriteCommand "./bmd_anasdi -c $CAPTURE_CHANNELS -mode $CAPTURE_MODE -f $CAPTURE_PRIMARY_BUFFER -s $CAPTURE_SECONDARY_BUFFER -mc 0 -tt $CAPTURE_TIMECODE $CAPTURE_OPTIONS" elif [ $CAPTURE_PROGRAM = "TESTGEN" ] ; then ! WriteCommand "./testgen -c $CAPTURE_CHANNELS" else echo "Invalid ingex.conf or argument. exit." return 1 fi fi # ** multicasting ** if [ $MULTICAST -ge 1 ] ; then ! SetupTab "Multicast" # Prepare options. If mpeg transport stream, set -t option and bitrate if [ $MULTICAST_MPEG_TS -ge 1 ] ; then *************** *** 292,318 **** OPTIONS="${OPTIONS} -s ${MULTICAST_SIZE}" - qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 "Multicast" - qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $capture_path" - qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' PORT=$MULTICAST_FIRST_PORT while [ "$CHAN" -lt "$CAPTURE_CHANNELS" ] ; do #echo "Starting multicast channel ${CHAN}" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./nexus_multicast -c ${CHAN} -q ${OPTIONS} ${MULTICAST_ADDR}:${PORT} &" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' let CHAN=$CHAN+1 let PORT=$PORT+1 done - tab= fi # ** Transfer ** if [ $TRANSFER -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 "Copy" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $xfer_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' if [ -n "${COPY_EXTRA_DEST}" ] ; then --- 299,315 ---- OPTIONS="${OPTIONS} -s ${MULTICAST_SIZE}" PORT=$MULTICAST_FIRST_PORT while [ "$CHAN" -lt "$CAPTURE_CHANNELS" ] ; do #echo "Starting multicast channel ${CHAN}" ! WriteCommand "./nexus_multicast -c ${CHAN} -q ${OPTIONS} ${MULTICAST_ADDR}:${PORT} &\n" let CHAN=$CHAN+1 let PORT=$PORT+1 done fi # ** Transfer ** if [ $TRANSFER -ge 1 ] ; then ! SetupTab "Copy" ! WriteCommand "cd $xfer_path" if [ -n "${COPY_EXTRA_DEST}" ] ; then *************** *** 320,434 **** fi if [ -z "${COPY_FTP_SERVER}" ] ; then ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./xferserver.pl ${EXTRA_DEST}" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' else FTP_OPTIONS="'${COPY_FTP_SERVER} ${COPY_FTP_USER} ${COPY_FTP_PASSWORD}'" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./xferserver.pl ${EXTRA_DEST} -f $FTP_OPTIONS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' fi - tab= fi if [ $INGEX_MONITOR -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 "nexusWeb" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $capture_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./nexus_web" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! tab= fi if [ $SYSTEM_MONITOR -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 sysInfo ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $capture_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "./system_info_web" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! tab= fi if [ $QUAD_SPLIT -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 Quad ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $scripts_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "$INGEX_DIR/player/ingex_player/player $QUAD_OPTIONS" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! tab= fi if [ $ROUTER_LOGGER -ge 1 ] ; then ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! sleep 1 ! fi ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 RouterLogger ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $routerlogger_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "${run_routerLogger}" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! tab= fi ! # Start recorders if any are set in the configuration if [ -n "$RECORDERS" ] ; then - # get the pids of exisiting windows - PIDS=`pidof konsole` - - # make an exclusion list of existing windows - ARGS="" - for pid in $PIDS; do - ARGS="${ARGS} -o ${pid}" - done - - # start a new konsole window - #konsole - - # find the pid of the new window - PID=$(pidof ${ARGS} konsole) - - #order_window="org.kde.konsole-${PID}" - #echo "New Window is $recorder_window..." - - # save PID - echo ${PID} >> ${KONSOLE_PIDS} - - # seem to need this to allow things to settle! - sleep 1 - - # move/resize the window in pixels - #qdbus $recorder_window /konsole/MainWindow_1 \ - # org.freedesktop.DBus.Properties.Set com.trolltech.Qt.QWidget geometry 0,500,1024,344 - #echo "Started konsole $capture_window" - - # start ingex recorders - #tab=$(qdbus $recorder_window /Konsole org.kde.konsole.Konsole.currentSession) echo $RECORDERS for REC in $RECORDERS ; do echo "Starting recorder: $REC" ! if [ -z $tab ] ; then ! tab=$(qdbus $capture_window /Konsole org.kde.konsole.Konsole.newSession) ! fi ! echo $REC ! #echo "tab is $tab" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.setTitle 1 $REC ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "cd $recorder_path" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText "${run_recorder} --name ${REC} ${DB_PARAMS} ${CORBA_OPTIONS}" ! qdbus $capture_window /Sessions/$tab org.kde.konsole.Session.sendText $'\n' ! tab= done - fi --- 317,368 ---- fi if [ -z "${COPY_FTP_SERVER}" ] ; then ! WriteCommand "./xferserver.pl ${EXTRA_DEST}" else FTP_OPTIONS="'${COPY_FTP_SERVER} ${COPY_FTP_USER} ${COPY_FTP_PASSWORD}'" ! WriteCommand "./xferserver.pl ${EXTRA_DEST} -f $FTP_OPTIONS" fi fi if [ $INGEX_MONITOR -ge 1 ] ; then ! SetupTab "nexusWeb" ! WriteCommand "cd $capture_path" ! WriteCommand "./nexus_web" fi if [ $SYSTEM_MONITOR -ge 1 ] ; then ! SetupTab "sysInfo" ! WriteCommand "cd $capture_path" ! ! WriteCommand "./system_info_web" fi + if [ $QUAD_SPLIT -ge 1 ] ; then ! SetupTab "Quad" ! WriteCommand "cd $scripts_path" ! ! WriteCommand "$INGEX_DIR/player/ingex_player/player $QUAD_OPTIONS" fi + if [ $ROUTER_LOGGER -ge 1 ] ; then ! SetupTab "RouterLogger" ! WriteCommand "${run_routerLogger}" fi ! # Start recorders if any are set in the configuration - in the same konsole as they can be detached by the user if [ -n "$RECORDERS" ] ; then echo $RECORDERS for REC in $RECORDERS ; do echo "Starting recorder: $REC" ! SetupTab "Recorder_$REC" ! WriteCommand "cd $recorder_path" ! WriteCommand "${run_recorder} --name ${REC} ${DB_PARAMS} ${CORBA_OPTIONS}" done fi + # Start it all up + konsole --tabs-from-file $KONSOLE_TABS_FILE --name "Ingex" + + # Save konsole PID for killing later + echo $(ps -fC konsole|grep "\--tabs-from-file"|sed -e "s/[^0-9]*//; s/[^0-9].*//") > $KONSOLE_PIDS |