Mercurial > hg > aimc
changeset 520:2e53a3b92525
AIM-o-matic scripts for automated running of AIM on a server.
author | tom@acousticscale.org |
---|---|
date | Wed, 22 Feb 2012 14:03:43 +0000 |
parents | 0518da52cb35 |
children | 065a3765b3d2 |
files | trunk/scripts/aim-o-matic/aim-o-matic.php trunk/scripts/aim-o-matic/aim_o_matic_cronjob.sh trunk/scripts/aim-o-matic/prepare_aws_instance.sh trunk/scripts/aim-o-matic/prepare_aws_instance_stage_2.sh trunk/scripts/aim-o-matic/upload-form.html trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc |
diffstat | 6 files changed, 85 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/scripts/aim-o-matic/aim-o-matic.php Wed Feb 22 14:03:43 2012 +0000 @@ -0,0 +1,17 @@ +<?php +if ($_FILES["audio_file"]["size"] < 20000000 && $_FILES["config_file"]["size"] < 2000000) { + if ($_FILES["audio_file"]["error"] > 0 || $_FILES["config_file"]["error"]) { + echo "error: file upload failed"; + } else { + $id_string = uniqid("aim-o-matic", true); + $ext = pathinfo($_FILES["audio_file"]["name"], PATHINFO_EXTENSION); + move_uploaded_file($_FILES["audio_file"]["tmp_name"], "/home/ubuntu/upload/" . $id_string . "." . $ext); + move_uploaded_file($_FILES["config_file"]["tmp_name"], "/home/ubuntu/upload/" . $id_string . ".config"); + echo "Results will be avaiable shortly, here:<br>"; + echo "<a href='results/" . $id_string . "/'>" . $id_string . "</a>"; + } +} else { + echo "error: file too large"; +} + +?>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/scripts/aim-o-matic/aim_o_matic_cronjob.sh Wed Feb 22 14:03:43 2012 +0000 @@ -0,0 +1,36 @@ +#!/bin/bash + +export PATH=$PATH:/usr/local/bin/ + +INPUT_DIR=/home/ubuntu/upload +DONE_DIR=/home/ubuntu/processed +mkdir ${DONE_DIR} +OUTPUT_DIR=/var/www/results +sudo mkdir $OUTPUT_DIR +sudo chmod o+w $OUTPUT_DIR +AIMC_DIR=/home/ubuntu/aimc/build/posix-release/ +AIMC=$AIMC_DIR/AIMCopy + +mkdir -p /tmp/aimc/ + +for t in `seq 1 580`; do +for f in `ls $INPUT_DIR/*.config`; do + b=`basename $f` + WORKING_ID=${b%.config} + THIS_OUTPUT_DIR=${OUTPUT_DIR}/${WORKING_ID} + OUTPUT_BASE=${THIS_OUTPUT_DIR}/${WORKING_ID} + mkdir ${THIS_OUTPUT_DIR} + SCRIPT_FILE=${OUTPUT_BASE}.script + PARAMS_FILE=${OUTPUT_BASE}.complete_params + GRAPH_FILE=${OUTPUT_BASE}.dot + GRAPH_IMAGE=${OUTPUT_BASE}.png + ext="wav" + echo ${INPUT_DIR}/${WORKING_ID}.${ext} ${THIS_OUTPUT_DIR}/${WORKING_ID} | cat >> ${SCRIPT_FILE} + rm /tmp/aimc/* + $AIMC -C ${f} -S ${SCRIPT_FILE} -D ${PARAMS_FILE} -G ${GRAPH_FILE} + dot -Tpng -o ${GRAPH_IMAGE} ${GRAPH_FILE} + sudo chown www-data ${THIS_OUTPUT_DIR} + mv ${INPUT_DIR}/${WORKING_ID}.* ${DONE_DIR}/ +done +sleep 1 +done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/scripts/aim-o-matic/prepare_aws_instance.sh Wed Feb 22 14:03:43 2012 +0000 @@ -0,0 +1,6 @@ +#!/bin/bash +sudo apt-get -y update +sudo apt-get -y install subversion +svn checkout http://aimc.googlecode.com/svn/trunk/ aimc +aimc/scripts/aim-o-matic/prepare_aws_instance_stage_2.sh +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/scripts/aim-o-matic/prepare_aws_instance_stage_2.sh Wed Feb 22 14:03:43 2012 +0000 @@ -0,0 +1,8 @@ +#!/bin/bash +sudo apt-get -y install scons pkg-config libsndfile1-dev build-essential ffmpeg apache2 php5 libcairo-dev libapache2-mod-php5 graphviz +sudo a2enmod php5 +sudo apache2ctl restart +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR/../../ +scons +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/scripts/aim-o-matic/upload-form.html Wed Feb 22 14:03:43 2012 +0000 @@ -0,0 +1,16 @@ +<html> +<body> + +<form action="aim-o-matic.php" method="post" +enctype="multipart/form-data"> +<label for="audio_file">Audio File</label> +<input type="file" name="audio_file" id="audio_file" /> +<label for="config_file">Config File</label> +<input type="file" name="config_file" id="config_file" /> +<br /> +<input type="submit" name="submit" value="Submit" /> +</form> + +</body> +</html> +
--- a/trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc Tue Feb 21 11:56:47 2012 +0000 +++ b/trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc Wed Feb 22 14:03:43 2012 +0000 @@ -166,9 +166,9 @@ float frame_rate = global_parameters_->DefaultFloat("frame_rate", -1.0); char sCmdLine[1024]; //!\todo check that snprintf does not want a larger buffer snprintf(sCmdLine, sizeof(sCmdLine)/sizeof(sCmdLine[0]), - "%s -r %.2f -y -i \"%s\" -i \"%s%%06d.png\" " + "%s -y -i \"%s\" -i \"%s%%06d.png\" " "-sameq -r %.2f -ar 44100 -acodec pcm_s16le %s \"%s\"", - sffmpegPath, frame_rate, sound_filename_.c_str(), directory_.c_str(), + sffmpegPath, sound_filename_.c_str(), directory_.c_str(), frame_rate, sCodecOptions, movie_filename_.c_str()); printf(sCmdLine); printf("\n");