Compare commits

..

113 Commits

Author SHA1 Message Date
Louwrentius
0869dc92ac Current version of ppss 2010-01-31 19:39:58 +00:00
Louwrentius
05945843f0 Changed the licence from BSD-style licence to GPL. 2010-01-27 19:45:56 +00:00
Louwrentius
a4b5fdc7c1 backup 2009-12-17 18:38:35 +00:00
Louwrentius
43e68825a3 Reworked the ppss-test script to work with the new ppss executable and changed the default workig dir of ppss 2009-12-17 18:16:02 +00:00
Louwrentius
204537cd04 Renamed ppss.sh to ppss, to make it more like a regular unix program. 2009-12-17 18:06:51 +00:00
Louwrentius
297f5eacb8 Fixed issue with master SSH connection on node not being setup. 2009-12-17 15:34:28 +00:00
Louwrentius
f3666a49d6 Some 'gui' bugfixes. 2009-12-17 14:45:15 +00:00
Louwrentius
3abe84f218 workdir must be relative to current path. 2009-12-17 01:59:28 +00:00
Louwrentius
24b368e734 Reworked ppss regarding process management.. 2009-12-17 01:52:42 +00:00
Louwrentius
7d0815528e More small fixes. 2009-12-16 20:27:09 +00:00
Louwrentius
f2ccafefc6 some rework 2009-12-16 18:29:18 +00:00
Louwrentius
20e520e820 Significant bug fixing and testing. Updated to 2.45 2009-12-16 12:34:03 +00:00
Louwrentius
fffccc3e04 Seems to fix some file name issues... 2009-12-15 23:03:23 +00:00
Louwrentius
e91f54932c Marking current version as 2.40 2009-11-08 17:54:41 +00:00
Louwrentius
fedd72bf1c Marking current version as 2.40 2009-11-08 17:50:49 +00:00
Louwrentius
e4bdd59475 More fixes for distributed operation. 2009-11-08 17:50:12 +00:00
Louwrentius
1b16eb62ee More fixes for distributed operation. 2009-11-08 17:14:01 +00:00
Louwrentius
d08dc38761 More fixes for distributed operation. 2009-11-08 16:58:06 +00:00
Louwrentius
cd4545d0c3 Fixed distributed ppss mechanism. 2009-11-08 15:16:49 +00:00
Louwrentius
05801b6773 Working on distributed home dir. 2009-10-24 20:16:06 +00:00
Louwrentius
722b3b4ea6 Added start-delay for workers to spread the load. 2009-10-24 19:53:35 +00:00
Louwrentius
4d28218ce4 Reworked the percent and job counter. 2009-10-24 19:24:56 +00:00
Louwrentius
b1af50040f Rewrote the usage and help screens. 2009-10-24 18:24:45 +00:00
Louwrentius
5b840d33c3 Cleaning things up, like some stuff with PPSS_DIR and PPSS_HOME_DIR 2009-10-24 15:52:40 +00:00
Louwrentius
207e875727 This version is also detecting CPUs on Solaris. 2009-10-21 21:23:36 +00:00
Louwrentius
4a682daaae This version is also detecting CPUs on Solaris. 2009-10-21 20:56:07 +00:00
Louwrentius
276e721c7e This version is also detecting CPUs on Solaris. 2009-10-21 20:43:10 +00:00
Louwrentius
239e422354 PPSS can now be run with multiple instances in stand-alone mode. 2009-10-21 19:44:59 +00:00
Louwrentius
fd7f32668e Working on ability to run multiple instances. 2009-10-21 19:35:40 +00:00
Louwrentius
e7f158235a Keeping a list of pids 2009-10-21 19:23:18 +00:00
Louwrentius
7a578ff88b Fixed irritating typo that caused the occurance of a file called '1' with some error message within. 2009-10-21 18:48:16 +00:00
Louwrentius
e24cf063e9 update 2009-10-21 18:26:21 +00:00
Louwrentius
fb3905ad11 Fixed status display of distributed ppss. 2009-09-27 10:51:32 +00:00
Louwrentius
9a880c313d fixed status handling 2009-09-26 20:43:24 +00:00
Louwrentius
3a8257e519 fixed typo 2009-09-26 18:50:24 +00:00
Louwrentius
e402fa6936 Major rework, PPSS is now fully asynchronous. There are no while loops polling stuff at an interval. 2009-09-26 18:25:43 +00:00
Louwrentius
24bdb33583 Major rework, PPSS is now fully asynchronous. There are no while loops polling stuff at an interval. 2009-09-26 18:24:54 +00:00
Louwrentius
d2e6bf7c54 proper version 2009-09-25 19:30:15 +00:00
Louwrentius
95eb2e0d07 improved some distributed stuff 2009-09-25 19:14:09 +00:00
Louwrentius
1da1de4b18 Improved distributed ppss 2009-09-20 09:04:23 +00:00
Louwrentius
7ca08b87cf bug fix 2.20 2009-08-09 20:12:51 +00:00
Louwrentius
815bb952c9 fixed language typo 2009-08-09 17:17:08 +00:00
Louwrentius
9b0e5fdec5 Improved error handling and messages. 2009-08-09 16:40:09 +00:00
Louwrentius
ebd7ca55b7 Improved error handling and messages. 2009-08-09 16:12:23 +00:00
Louwrentius
04847e14db Added improvements regarding multi-user environments as reported by cinly.ooi 2009-08-09 15:49:58 +00:00
Louwrentius
64486cb710 fixed typo (succes) 2009-07-03 22:53:11 +00:00
Louwrentius
e6d3539b51 upped version number 2009-05-05 20:30:19 +00:00
Louwrentius
a4f1107863 added extra sanitizing of input but it is not perfect. 2009-05-05 20:29:42 +00:00
Louwrentius
ac7192cfde 2.18 2009-03-29 21:59:43 +00:00
Louwrentius
7ae3f7c512 version 2.17 with nifty status screen. 2009-03-29 20:48:15 +00:00
Louwrentius
9e4a89e95f Improved escaping of file names 2009-03-27 21:54:15 +00:00
Louwrentius
62059e887e backup 2009-03-27 20:16:00 +00:00
Louwrentius
66e04d8806 PPSS improved... 2009-03-23 23:04:41 +00:00
Louwrentius
113f4d31cb better path handling 2009-03-23 20:24:20 +00:00
Louwrentius
64edfe79c1 Fixes almost complete, more testing needed 2009-03-22 18:06:30 +00:00
Louwrentius
be217ac168 Currently fixing file name sanitizing. 2009-03-22 17:15:47 +00:00
Louwrentius
49d54913f7 fixing filename sanitation 2009-03-22 12:14:26 +00:00
Louwrentius
2f5b38aedd fixing filename sanitation 2009-03-22 11:15:13 +00:00
Louwrentius
1e26cef172 fixing filename sanitation 2009-03-22 10:05:36 +00:00
Louwrentius
046ba029dc fixin g filename sanitation 2009-03-22 10:01:36 +00:00
Louwrentius
e5dcc81930 fixin g filename sanitation 2009-03-22 09:59:47 +00:00
Louwrentius
d523525eca Currently fixing file name sanitizing. 2009-03-22 09:40:31 +00:00
Louwrentius
8b1e5fed9a ppss is still a bit buggy 2009-03-21 23:30:15 +00:00
Louwrentius
bd75afbf41 significant bugfixes when using no script 2009-03-21 22:37:38 +00:00
Louwrentius
b3ba085fbe 2.11 - Ok version with fixed file handling when using input file instead of dir 2009-03-21 20:50:37 +00:00
Louwrentius
d2a8a6e08d 2.11 - Ok version with fixed file handling when using input file instead of dir 2009-03-21 20:45:05 +00:00
Louwrentius
964648de7f 2.10 - Ok version with fixed file handling when using input file instead of dir 2009-03-21 20:34:45 +00:00
Louwrentius
3f6343318a Ok version with fixed file handling when using input file instead of dir 2009-03-21 20:34:05 +00:00
Louwrentius
71e8d829d9 messing around with paths in items 2009-03-21 20:17:01 +00:00
Louwrentius
aaae2dc713 fixing download function 2009-03-21 19:57:57 +00:00
Louwrentius
3e5fbfd38f 2.08 fixes 2.07 2009-03-15 21:51:30 +00:00
Louwrentius
b1fa580a3e Bug fix, 2.07 is broken. 2009-03-15 20:51:18 +00:00
Louwrentius
954d8632c1 Added config option for known_hosts file. 2009-03-15 00:35:53 +00:00
Louwrentius
c6161eb4b4 Forgot to uptdate the version. 2009-03-13 10:47:54 +00:00
Louwrentius
04f13096a4 Parallel deployment of ppss + new mechanism for specifing output files. 2009-03-13 10:12:10 +00:00
Louwrentius
244cfce933 New function display_header, just for better looks. 2009-03-12 20:48:14 +00:00
Louwrentius
c8f4a2caa0 version 2.03 2009-03-10 23:00:33 +00:00
Louwrentius
4b45db3169 Cleaned up some logging. 2009-03-10 22:04:13 +00:00
Louwrentius
d0a2413f64 Polished logging and cpu/core detection. 2009-03-10 21:32:12 +00:00
Louwrentius
c0d58e6752 test 2009-03-10 20:36:33 +00:00
Louwrentius
5317a82ac4 Updated description. 2009-03-09 20:46:46 +00:00
Louwrentius
d8c73dba4b Version 2.0. 2009-03-08 22:49:23 +00:00
Louwrentius
f6062bfdaf Added proper handling of start stop and continue for distributed processing. 2009-03-08 15:18:15 +00:00
Louwrentius
979b1cc0a4 Working on help screen. 2009-03-08 14:24:28 +00:00
Louwrentius
ffeaf1ccf6 Updated help page. Not finished yet. 2009-03-05 23:19:55 +00:00
Louwrentius
808d14e08c Cleaning up code and comments. 2009-03-04 21:18:05 +00:00
Louwrentius
73d49b125b Added logging of processing time of item. If scp is disabled, assume -d directory is local, not remote. 2009-03-02 20:57:28 +00:00
Louwrentius
c3975dd64a bug fixes 2009-03-02 02:25:12 +00:00
Louwrentius
0a35341033 Renamed all command line options in long format that is more readable. 2009-03-01 23:25:16 +00:00
Louwrentius
1bdfe61490 This version has been used to encode wavs on 3 different host in parallel. 2009-03-01 22:33:09 +00:00
Louwrentius
02f0d7b4fa update 2009-03-01 21:18:52 +00:00
Louwrentius
21114ec54a The full chain of downloading items to the node, processing and uploading the result back to the server is now functional. 2009-03-01 21:04:16 +00:00
Louwrentius
cca01f27fd backup 2009-03-01 20:58:48 +00:00
Louwrentius
f83f916c57 backup 2009-03-01 20:57:16 +00:00
Louwrentius
628e93c904 messed up 2009-03-01 20:32:28 +00:00
Louwrentius
c231b8e05a Distributed PPSS seems to be working, need more testing. 2009-03-01 17:27:17 +00:00
Louwrentius
6bd4d48a76 Better item logging and error handling. 2009-03-01 16:47:44 +00:00
Louwrentius
66a8983a3e filenames with spaces seem to be handled properly. 2009-03-01 16:10:53 +00:00
Louwrentius
aa15c6f868 PPSS can now substitute %ITEM% in commando string for the current item. 2009-03-01 10:17:27 +00:00
Louwrentius
f6b9fad83a Distributed PPSS is now able to show overall progress, thus how many items have been processed. 2009-02-28 19:27:30 +00:00
Louwrentius
af1eda73d4 Removed usage of bc so this is not a dependency anymore. 2009-02-28 19:11:48 +00:00
Louwrentius
7c16a77860 Bacup 2009-02-28 19:05:20 +00:00
Louwrentius
ed55ae5137 Bacup 2009-02-28 18:42:16 +00:00
Louwrentius
39c1ecf542 Reworked OS detection and proces detection, which differs for Linux and Mac OS X 2009-02-28 17:44:02 +00:00
Louwrentius
2edb204c4c This seems the first solid working version of Distributed PPSS. 2009-02-28 16:39:32 +00:00
Louwrentius
bca4fda670 just a backup, broken and a mess 2009-02-28 15:51:00 +00:00
Louwrentius
cacb489c14 broken en messed up - just a backup 2009-02-28 08:40:11 +00:00
Louwrentius
fc5d48b73c got rid of getopts and did it by hand, much better 2009-02-27 19:14:38 +00:00
Louwrentius
2e76e5e34e buggy and broken 2009-02-27 18:17:58 +00:00
Louwrentius
0090a68d70 fixed some cleanup issues with screen 2009-02-08 21:36:40 +00:00
Louwrentius
a8bb31a575 backup - broken 2009-02-08 16:41:34 +00:00
Louwrentius
04501ea92a first checkin test 2009-01-31 17:54:45 +00:00
Louwrentius
f7c2f34cb5 creating branch for distributed ppss 2009-01-31 17:52:50 +00:00
11 changed files with 2998 additions and 3852 deletions

View File

@ -1 +0,0 @@
Automatically exported from code.google.com/p/ppss

View File

@ -1,94 +0,0 @@
#!/usr/bin/env bash
INPUT="$1"
METATAGS="--export-tags-to="
LAMEOPTS=""
ERROR_STATUS="0"
function usage () {
echo
echo "Usage: $0 <flac file name>"
echo
exit 1
}
function error () {
ERROR="$1"
MSG="$2"
echo "Error: $MSG"
exit 1
}
if [ -z "$INPUT" ]
then
usage
fi
if [ ! -e "$INPUT" ]
then
echo "File $INPUT does not exist!"
exit 1
fi
FILETYPE="`file -b "$INPUT" | awk '{ print $1 }'`"
if [ ! "$FILETYPE" == "FLAC" ]
then
echo "File $FILE is not a flac file..."
exit 0
fi
checkvar () {
VAR="$1"
if [ -z "$VAR" ] || [ "$VAR" == "" ]
then
echo "Unknown"
else
echo "$VAR"
fi
}
METATAGS="TITLE ARTIST ALBUM GENRE COMPOSER CONDUCTOR ENSEMBLE TRACKNUMBER DATE ALBUM ARTIST DISCNUMBER DISC"
function convert () {
FILE="$1"
META="$FILE.meta"
MP3FILE="`echo ${FILE%flac}mp3`"
DIR="`dirname "$FILE"`"
metaflac --export-tags-to="$META" "$FILE"
ARTIST="`metaflac "$FILE" --show-tag=ARTIST | sed s/.*=//g`"
TITLE="`metaflac "$FILE" --show-tag=TITLE | sed s/.*=//g`"
ALBUM="`metaflac "$FILE" --show-tag=ALBUM | sed s/.*=//g`"
GENRE="`metaflac "$FILE" --show-tag=GENRE | sed s/.*=//g`"
TRACKNUMBER="`metaflac "$FILE" --show-tag=TRACKNUMBER | sed s/.*=//g`"
for x in $METATAGS
do
declare $x="`grep "$x" "$META" | cut -d "=" -f 2`"
VAR=$(eval echo " \$$x")
VAR="`checkvar $VAR`"
done
flac -s -c -d "$FILE" | lame --tt "$TITLE" --tn "$TRACKNUMBER" --tg "$GENRE" --ty "$DATE" --ta "$ARTIST" --tl "$ALBUM" --ty "$YEAR" --preset insane - "$MP3FILE"
ERROR_STATUS="$?"
if [ -e "$META" ]
then
rm "$META"
fi
}
convert "$INPUT"
exit "$ERROR_STATUS"

3220
ppss

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,20 @@
#!/bin/bash #!/bin/bash
DEBUG="$1" DEBUG="$1"
VERSION="2.98" VERSION=2.55
TMP_DIR="/tmp/ppss" TMP_DIR="ppss"
PPSS=./ppss PPSS=ppss
PPSS_DIR=ppss_dir PPSS_DIR=ppss_dir
export PPSS_DEBUG=1
HOST_ARCH=`uname`
SPECIAL_DIR=$TMP_DIR/root/special
. "$PPSS"
cleanup () { cleanup () {
unset RES1 for x in $REMOVEFILES
unset RES2 do
GLOBAL_COUNTER=1 if [ -e ./$x ]
if [ ! "$DEBUG" = "debug" ] then
then rm -r ./$x
for x in $REMOVEFILES fi
do done
if [ -e ./$x ]
then
rm -r ./$x
fi
done
fi
if [ ! -z "$TMP_DIR" ] && [ -e "$TMP_DIR" ]
then
rm -rf "$TMP_DIR"
fi
} }
parseJobStatus () { parseJobStatus () {
@ -39,38 +24,45 @@ parseJobStatus () {
RES=`grep "Status:" "$JOBLOG/$TMP_FILE"` RES=`grep "Status:" "$JOBLOG/$TMP_FILE"`
STATUS=`echo "$RES" | awk '{ print $2 }'` STATUS=`echo "$RES" | awk '{ print $2 }'`
echo "$STATUS" echo "$STATUS"
}
get_item_count_of_input_file () {
if [ -e "$PPSS_DIR/INPUT_FILE-$$" ]
then
CONTENTS_OF_INPUTFILE=`cat $PPSS_DIR/INPUT_FILE-$$ | wc -l | awk '{ print $1 }'`
echo "$CONTENTS_OF_INPUTFILE"
else
echo "Error, file $PPSS_DIR/INPUT_FILE-$$ does not exist."
fi
} }
oneTimeSetUp () { oneTimeSetUp () {
NORMALTESTFILES=`echo test-{a..z}`
SPECIALTESTFILES="\'file-!@#$%^&*()_+=-0987654321~\' \'file-/\<>?:;'{}[]\' file-/\/\:\/!@#$%^&*()_+=-0987654321~ file-/\<>?:;'{}[] http://www.google.nl ftp://storage.nl"
JOBLOG=./$PPSS_DIR/job_log JOBLOG=./$PPSS_DIR/job_log
INPUTFILENORMAL=test-normal.input INPUTFILENORMAL=test-normal.input
INPUTFILESPECIAL_DIR=test-special.input INPUTFILESPECIAL=test-special.input
LOCALOUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT LOCALOUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT
REMOVEFILES="$PPSS_DIR test-ppss-*"
if [ ! -e "$TMP_DIR" ] REMOVEFILES="$INPUTFILENORMAL $INPUTFILESPECIAL $PPSS_DIR test-ppss-*"
then
mkdir -p "$TMP_DIR"
fi
cleanup cleanup
for x in $NORMALTESTFILES
do
echo "$x" >> "$INPUTFILENORMAL"
done
for x in $SPECIALTESTFILES
do
echo $x >> "$INPUTFILESPECIAL"
done
} }
testVersion () { testVersion () {
assertEquals "Version mismatch!" "$VERSION" "$SCRIPT_VERSION" RES=`./$PPSS -v`
for x in $RES
do
echo "$x" | grep [0-9] >> /dev/null
if [ "$?" == "0" ]
then
assertEquals "Version mismatch!" "$VERSION" "$x"
fi
done
} }
rename-ppss-dir () { rename-ppss-dir () {
@ -93,191 +85,139 @@ oneTimeTearDown () {
createDirectoryWithSomeFiles () { createDirectoryWithSomeFiles () {
ROOT_DIR=$TMP_DIR/root A="File with Spaces"
CHILD_1=$ROOT_DIR/child_1 B="File\With\Slashes"
CHILD_2=$ROOT_DIR/child_2
if [ ! -e "$ROOT_DIR" ] mkdir "/tmp/$TMP_DIR"
then for x in "$A" "$B"
mkdir -p "$ROOT_DIR"
fi
if [ ! -e "$CHILD_1" ]
then
mkdir -p "$CHILD_1"
fi
if [ ! -e "$CHILD_2" ]
then
mkdir -p "$CHILD_2"
fi
for x in {1..10}
do do
touch "$ROOT_DIR/file-$x" TMP_FILE="/tmp/$TMP_DIR/$x"
touch "$CHILD_1/file-$x" touch "$TMP_FILE"
touch "$CHILD_2/file-$x"
done done
ln -s /etc/resolve.conf "$ROOT_DIR" 2> /dev/null
ln -s /etc/hosts "$ROOT_DIR" 2> /dev/null
} }
createSpecialFilenames () { testSpacesInFilenames () {
ERROR=0
mkdir -p "$SPECIAL_DIR"
touch "$SPECIAL_DIR/a file with spaces"
touch "$SPECIAL_DIR/a\\'file\\'with\\'quotes"
touch "$SPECIAL_DIR/a{file}with{curly}brackets}"
touch "$SPECIAL_DIR/a(file)with(parenthesis)"
touch "$SPECIAL_DIR/a\\file\\with\\backslashes"
touch "$SPECIAL_DIR/a!file!with!exclamationmarks"
touch "$SPECIAL_DIR/a filé with special characters"
touch "$SPECIAL_DIR/a\"file\"with\"double\"quotes"
}
testMD5 () {
export USE_MD5=1
init_vars > /dev/null 2>&1
ARCH=Darwin
set_md5
assertEquals "MD5 executable not set properly - $MD5" "$MD5" "md5"
ARCH=Linux
set_md5
assertEquals "MD5 executable not set properly - $MD5" "$MD5" "md5sum"
ARCH=$HOST_ARCH
}
init_get_all_items () {
DIR="$1"
TRAVERSAL="$2"
createDirectoryWithSomeFiles createDirectoryWithSomeFiles
create_working_directory
export SRC_DIR=$DIR
init_vars > /dev/null 2>&1
get_all_items
}
testRecursion () { RES=$( { ./$PPSS -d /tmp/$TMP_DIR -c 'ls -alh ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
init_get_all_items $TMP_DIR/root 1 assertNull "PPSS retured some errors..." "$RES"
RESULT=`get_item_count_of_input_file` if [ ! "$?" == "0" ]
EXPECTED=32
assertEquals "Recursion not correct." "$EXPECTED" "$RESULT"
rename-ppss-dir $FUNCNAME
}
testNoRecursion () {
init_get_all_items $TMP_DIR/root 0
RESULT=`get_item_count_of_input_file`
EXPECTED=12
assertEquals "Recursion not correct." "$EXPECTED" "$RESULT"
rename-ppss-dir $FUNCNAME
}
testGetItem () {
createSpecialFilenames
init_get_all_items $TMP_DIR/root 1
get_item
if [ -z "$ITEM" ]
then then
ERROR=1 echo "RES IS $RES"
else
ERROR=0
fi fi
EXPECTED=0
assertEquals "Get item failed." "$EXPECTED" "$ERROR"
i=1 grep "SUCCESS" $JOBLOG/* >> /dev/null 2>&1
ERROR=0 assertEquals "Found error with space in filename $TMP_FILE" "0" "$?"
while get_item
do rm -rf "/tmp/$TMP_DIR"
((i++)) rename-ppss-dir $FUNCNAME
}
testSpecialCharacterHandling () {
RES=$( { ./$PPSS -f "$INPUTFILESPECIAL" -c 'echo ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
assertNull "PPSS retured some errors..." "$RES"
if [ ! "$?" == "0" ]
then
echo "RES IS $RES"
fi
RES=`find ppss_dir/PPSS_LOCAL_OUTPUT | wc -l | sed 's/\ //g'`
assertEquals "To many lock files..." "7" "$RES"
RES1=`ls -1 $JOBLOG`
RES2=`ls -1 $LOCALOUTPUT`
assertEquals "RES1 $RES1 is not the same as RES2 $RES2" "$RES1" "$RES2"
rename-ppss-dir $FUNCNAME
}
testSkippingOfProcessedItems () {
createDirectoryWithSomeFiles
RES=$( { ./$PPSS -d /tmp/$TMP_DIR -c 'echo ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
assertNull "PPSS retured some errors..." "$RES"
RES=$( { ./$PPSS -d /tmp/$TMP_DIR -c 'echo ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
assertNull "PPSS retured some errors..." "$RES"
grep -i skip ./$PPSS_dir/* >> /dev/null 2>&1
assertEquals "Skipping of items went wrong." 0 "$?"
rename-ppss-dir $FUNCNAME-1
RES=$( { ./$PPSS -f $INPUTFILESPECIAL -c 'echo ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
assertNull "PPSS retured some errors..." "$RES"
RES=$( { ./$PPSS -f $INPUTFILESPECIAL -c 'echo ' >> /dev/null ; } 2>&1 )
assertEquals "PPSS did not execute properly." 0 "$?"
assertNull "PPSS retured some errors..." "$RES"
grep -i skip ./$PPSS_dir/* >> /dev/null 2>&1
assertEquals "Skipping of items went wrong." 0 "$?"
rm -rf "/tmp/$TMP_DIR"
rename-ppss-dir $FUNCNAME-2
}
testExistLogFiles () {
./$PPSS -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null
assertEquals "PPSS did not execute properly." 0 "$?"
for x in $NORMALTESTFILES
do
assertTrue "[ -e $JOBLOG/$x ]"
done
rename-ppss-dir $FUNCNAME
}
getStatusOfJob () {
EXPECTED="$1"
if [ "$EXPECTED" == "SUCCESS" ]
then
./$PPSS -f "$INPUTFILENORMAL" -c 'echo ' >> /dev/null
assertEquals "PPSS did not execute properly." 0 "$?"
elif [ "$EXPECTED" == "FAILURE" ]
then
./$PPSS -f "$INPUTFILENORMAL" -c 'thiscommandfails ' >> /dev/null
assertEquals "PPSS did not execute properly." 0 "$?"
fi
for x in $NORMALTESTFILES
do
STATUS=`parseJobStatus "$x"`
assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS"
done done
EXPECTED=40
assertEquals "Got wrong number of items." "$EXPECTED" "$i"
rename-ppss-dir $FUNCNAME rename-ppss-dir "$FUNCNAME-$EXPECTED"
cleanup
}
return_all_items () {
while get_item
do
ALL_ITEMS="$ALL_ITEMS$ITEM"$'\n'
done
echo "$ALL_ITEMS"
}
testNumberOfItems () {
createSpecialFilenames
RESULT=`init_get_all_items $TMP_DIR/root 1`
RES1=`find $TMP_DIR/root/ ! -type d`
RES2=`return_all_items`
echo "$RES1" > a
echo "$RES2" > b
assertEquals "Input file and actual files not the same!" "$RES1" "$RES2"
rename-ppss-dir $FUNCNAME
} }
testInvalidProcessingOfitemVariable() { testErrorHandlingOK () {
createSpecialFilenames getStatusOfJob SUCCESS
init_get_all_items $TMP_DIR/root 1 }
COMMAND='echo $ITEM'
while get_item testErrorHandlingFAIL () {
do
commando "$ITEM" getStatusOfJob FAILURE
done
RESULT=$(grep '$ITEM' $PPSS_DIR/job_log/*)
EXPECTED=""
assertEquals "Got incorrect processing of ITEM variable." "$EXPECTED" "$RESULT"
rename-ppss-dir $FUNCNAME
} }
testNumberOfLogfiles () {
createSpecialFilenames
init_get_all_items $TMP_DIR/root 1
COMMAND='echo hoi'
while get_item
do
commando "$ITEM"
done
RESULT=`ls -1 $PPSS_DIR/job_log/ | wc -l | awk '{ print $1}'`
EXPECTED=40
assertEquals "Got wrong number of log files." "$EXPECTED" "$RESULT"
rename-ppss-dir $FUNCNAME
}
testUserInputFile () {
cleanup
INPUT_FILE=test-special.input
create_working_directory
init_vars > /dev/null 2>&1
get_all_items
RESULT=`return_all_items`
ORIGINAL=`cat $INPUT_FILE`
assertEquals "User input processing not ok." "$RESULT" "$ORIGINAL"
rename-ppss-dir $FUNCNAME
}
. ./shunit2 . ./shunit2

View File

@ -1,14 +0,0 @@
REMOTE_OUTPUT_DIR=/mnt/mp3
SSH_KEY=ppss-key.dsa
SSH_KNOWN_HOSTS=known_hosts
SRC_DIR=/mnt/wav
COMMAND='./wav2mp3.sh "$ITEM" "$OUTPUT_DIR"'
NODES_FILE=nodes.txt
SSH_SERVER=10.0.1.110
USER=ppss
SCRIPT=wav2mp3.sh
RANDOMIZE=1
DOWNLOAD_TO_NODE=0
UPLOAD_TO_SERVER=0
SECURE_COPY=1
PPSS_DEBUG=1

1824
ppss.sh Executable file

File diff suppressed because it is too large Load Diff

1116
shunit2

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
test-a
test-b
test-c
test-d
test-e
test-f
test-g
test-h
test-i
test-j
test-k
test-l
test-m
test-n
test-o
test-p
test-q
test-r
test-s
test-t
test-u
test-v
test-w
test-x
test-y
test-z

View File

@ -1,8 +0,0 @@
\'file-!@#$%^&*()_ +=-0987654321~\'
\'file-/\<>?:;'{}[]\'
file-/\/\:\/!@#$%^&*()_+=-0987654321~
file-42>424>424<2424>424?24<24>24
file-/\<>?:;'{}[]
http://www.google.nl
ftp://storage.nl
./flac/Bééthoven Overtures CD2/01 - Beethoven, Lv - Leonore I - Op.138.flac

View File

@ -1,124 +0,0 @@
#!/bin/bash
INPUT="$1"
RESOLUTION="$3"
SEPARATE="$4"
TITLES=0
OPTS_HIGHRES="-e x264 -q 20.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 1024 --strict-anamorphic -m"
OPTS_LOWRES="-e x264 -q 20.0 -a 1 -E faac -B 128 -6 dpl2 -R 48 -D 0.0 -f mp4 -X 480 -m -x cabac=0:ref=2:me=umh:bframes=0:subme=6:8x8dct=0:trellis=0"
OPTS_SOURCE="-e x264 -q 20.0 -a 1,1 -E faac,ac3 -l 576 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 --detelecine --decomb --strict-anamorphic -m -x b-adapt=2:rc-lookahead=50"
MODE=""
HANDBRAKE=HandBrakeCLI
DIRNAME=`dirname "$INPUT"`
BASENAME=`basename "$INPUT"`
OPTS=""
OUTPUT_DIR="$2"
OUTPUT_FILE_NAME=""
if [ -z "$INPUT" ]
then
echo "usage $0 <input file / folder> <output folder> <highres|lowres> <separate>"
echo
echo "Input either file, VIDEO_TS directory or .ISO"
echo
echo -e "highres:\t1024 x 576"
echo -e "lowres:\t\t480 x 320"
echo -e "source:\t\tsame as source."
echo
echo -e "separate:\tseparate files for episodes of a serie."
exit 1
fi
if [ ! -z "$OUTPUT_DIR" ]
then
if [ ! -e "$OUTPUT_DIR" ] || [ ! -d "$OUTPUT_DIR" ]
then
echo "Output directory does not exist or is not a directory."
exit 1
fi
else
echo "Output to current directory."
OUTPUT_DIR="."
fi
if [ ! -e "$INPUT" ]
then
echo "$INPUT does not exist!"
exit 1
fi
if [ -d "$INPUT" ]
then
MODE=DIR
else
MODE=FILE
fi
echo "Input type is $MODE"
case "$RESOLUTION" in
highres|HIGHRES )
OPTS="$OPTS_HIGHRES" ;;
lowres|LOWRES )
OPTS="$OPTS_LOWRES" ;;
source|SOURCE )
OPTS="$OPTS_SOURCE" ;;
*)
echo "Resolution must be 'highres', 'source' or 'lowres'."
exit 1
;;
esac
function titles () {
TITLES=`./$HANDBRAKE -t 0 -i "$INPUT" 2>&1 | grep "+ title" | awk '{ print $3 }' | sed s/://g`
echo $TITLES
}
if [ "$MODE" = "FILE" ]
then
mkdir -p "$OUTPUT_DIR/$DIRNAME"
OUTPUT_FILE_NAME="$OUTPUT_DIR/$DIRNAME/${BASENAME%.*}"
elif [ "$MODE" = "DIR" ]
then
echo "$INPUT" | grep -i video_ts >> /dev/null 2>&1
if [ "$?" = "0" ]
then
INTERMEDIATE2=`basename "$DIRNAME"`
mkdir -p "$OUTPUT_DIR/$DIRNAME"
OUTPUT_FILE_NAME="$OUTPUT_DIR/$DIRNAME/$INTERMEDIATE2"
else
INTERMEDIATE2="$BASENAME"
mkdir -p "$OUTPUT_DIR/$DIRNAME/$INTERMEDIATE2"
OUTPUT_FILE_NAME="$OUTPUT_DIR/$DIRNAME/$INTERMEDIATE2/$INTERMEDIATE2"
fi
echo "INTERMEDIATE2 = $INTERMEDIATE2"
else
echo "Mode is not determined..."
exit 1
fi
if [ "$SEPARATE" = "separate" ]
then
TITLES=`titles $INPUT`
echo "TITLES = $TITLES"
ERROR=0
for x in $TITLES
do
HandBrakeCLI $OPTS -i "$INPUT" -o "$OUTPUT_FILE_NAME-$x.mp4"
if [ ! "$?" = "0" ]
then
ERROR="1"
fi
done
exit "$ERROR"
else
echo "Creating a single file."
HandBrakeCLI $OPTS -i "$INPUT" -o "$OUTPUT_FILE_NAME.mp4"
fi

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
SRC="$1"
DEST="$2"
TYPE=`file -b "$SRC"`
RES=`echo "$TYPE" | grep "WAVE audio"`
if [ ! "$?" == "0" ]
then
echo "File $SRC is not a wav file..."
echo "Type is $TYPE"
exit 0
fi
BASENAME=`basename "$SRC"`
MP3FILE="`echo ${BASENAME%wav}mp3`"
lame --quiet --preset insane "$SRC" "$DEST/$MP3FILE"
exit "$?"