Compare commits

..

112 Commits

Author SHA1 Message Date
Jeffrey Paul e425c6fd5b add readme.md 2020-02-05 07:08:44 +00:00
louwrentius 2aec933067 Improved support for Solaris, thanks to Sbonds. 2012-03-24 21:12:02 +00:00
louwrentius 8e11672952 added shunit2 testsuite for convenience reasons. 2012-03-24 21:04:52 +00:00
louwrentius 2f612846cb Added patch as supplied by Steve Bonds for Solaris - contains NoRecursion bug. 2012-03-17 20:34:32 +00:00
louwrentius baa44063f4 updated version number 2012-01-29 22:05:18 +00:00
louwrentius b24d58294e updated version number 2012-01-29 22:05:04 +00:00
louwrentius 8fe6ca64db locking file name is now always md5 hash 2012-01-29 22:04:40 +00:00
louwrentius a33f87d0b0 version 2.97 2011-12-31 00:05:14 +00:00
louwrentius eb61175bf4 Fixed some bugs with item processing. 2011-12-28 23:03:27 +00:00
louwrentius 01b944ad9e removed unused --no-check option 2011-12-28 22:02:36 +00:00
louwrentius 66d0d3e4b2 improved some readability 2011-12-28 21:45:57 +00:00
louwrentius 42c4305ac5 Some additional issues fixed. 2011-12-25 04:45:49 +00:00
louwrentius d947d84646 Fixed daemon mode 2011-12-25 03:55:44 +00:00
louwrentius c78896892b Fixed daemon modes 2011-12-25 03:39:46 +00:00
louwrentius ec1d542ab6 Major rework on distributed mode 2011-12-25 02:11:46 +00:00
louwrentius 30f92bbae9 Major rework on distributed mode 2011-12-25 02:08:08 +00:00
louwrentius 74d1e90282 Major rework on distributed mode 2011-12-25 01:21:53 +00:00
louwrentius a06634d450 Major rework on distributed mode 2011-12-25 01:17:17 +00:00
louwrentius dbd8f51590 Major rework on distributed mode 2011-12-25 01:03:42 +00:00
louwrentius a908682185 fixed issue with processing processed items at the start 2011-09-23 21:00:42 +00:00
louwrentius 48c80d9257 fixed issue with processing processed items at the start 2011-09-23 20:59:12 +00:00
louwrentius 828e4d135c fixed issue with processing processed items at the start 2011-09-23 20:57:24 +00:00
louwrentius 114112241f fixed issue with processing processed items at the start 2011-09-23 20:50:53 +00:00
louwrentius 625eb7e1e4 Improved algorithm for removing processed items from the input file. It was stupid and is now smart. 2011-09-20 20:44:42 +00:00
louwrentius b69e1e6d7b Bugfixes 2011-09-01 01:35:18 +00:00
louwrentius edb7c21683 Distributed mode working properly with lame 2011-09-01 00:30:45 +00:00
louwrentius 55f4b1f2e2 some distributed mode bug fixes 2011-08-29 01:09:02 +00:00
louwrentius eaa18282d1 Fixed issue with listener and MD5 2011-08-23 22:26:51 +00:00
louwrentius 2dcb39ecbf Now switch between human recognisable log file names and md5 file names 2011-08-23 22:04:04 +00:00
louwrentius 136c1c13ca minor bug fixes 2011-08-22 22:28:22 +00:00
louwrentius c344794953 bugfixes 2011-08-21 22:12:33 +00:00
louwrentius bccd42ab9d Fixed issue with total failed counter in distributed mode. 2011-08-21 21:32:16 +00:00
louwrentius cc1aa38f05 Failed items now proagated to distributed mode. 2011-08-20 22:44:07 +00:00
louwrentius 836378eda8 PPSS now reports if items have failed 2011-08-20 20:57:54 +00:00
louwrentius ed4c0bf554 PPSS now reports if items have failed 2011-08-20 20:54:31 +00:00
louwrentius 72e0c983d0 Fixed find -d vs -date and exit status. 2011-08-17 22:36:50 +00:00
louwrentius 3c9a4d5ee8 speedup of status check of nodes 2011-08-11 20:50:33 +00:00
louwrentius 29713bcc14 Fixed issues with the distributed computing interface. Clients upload the status to the server. 'ppss status' does not need to poll all clients for their status. 2011-08-07 11:52:48 +00:00
louwrentius 126e71e231 Resolving lots of bugs, backup. 2011-08-06 18:08:41 +00:00
Louwrentius 2946abc3d6 Fixed some bugs 2011-02-13 22:53:30 +00:00
Louwrentius c07e95b2a2 Fixed various bugs, releae of 8.85, see changelog for details. 2010-11-21 19:40:50 +00:00
Louwrentius ff63e9950b Fixed various bugs, releae of 8.85, see changelog for details. 2010-11-21 19:40:34 +00:00
Louwrentius 8663f482c3 added utility script file 2010-08-06 00:32:24 +00:00
Louwrentius 427c97f5af backup.. 2010-08-05 12:16:59 +00:00
Louwrentius 654b52d91f backup 2010-07-21 06:24:25 +00:00
Louwrentius 2c42f7568e Almost ready for release. 2010-07-18 12:00:13 +00:00
Louwrentius 3ec86b451e Fixed inotify mechanism. 2010-07-18 09:42:29 +00:00
Louwrentius 1575fb28f6 Fixed inotify mechanism. 2010-07-18 09:37:19 +00:00
Louwrentius 20e8cdce95 PPSS passess the test case... 2010-07-18 08:14:47 +00:00
Louwrentius 7550b4a5c1 PPSS passess the test case... 2010-07-17 21:19:31 +00:00
Louwrentius c4bc6f963a PPSS passess the test case... 2010-07-17 20:34:17 +00:00
Louwrentius d18102ba58 PPSS passess the test case... 2010-07-17 20:32:02 +00:00
Louwrentius c220353e7e PPSS passess the test case... 2010-07-17 20:26:28 +00:00
Louwrentius ecc9d3da3b Backup, major overhaul of daemon mode and listener process... 2010-07-17 19:49:19 +00:00
Louwrentius caa6519d0f Backup, is broken. 2010-07-14 21:51:10 +00:00
Louwrentius 211bd40641 Backup, this version is broken. 2010-07-14 21:06:11 +00:00
Louwrentius 5614724162 backup, may be broken. 2010-07-12 21:37:49 +00:00
Louwrentius 55583de5f8 PPSS now supports inotify file system events. 2010-07-11 22:51:31 +00:00
Louwrentius b6bd8c6c33 Added infanticide function, cleaning things up. 2010-06-27 23:46:01 +00:00
Louwrentius c1a359340c PPSS tests fixed. 2010-06-27 08:59:22 +00:00
Louwrentius 6836784b54 Removed all file locking, except for remote item locking. 2010-06-20 21:22:19 +00:00
Louwrentius b922bd40e5 backup fixing distributed PPSS 2010-06-13 22:17:24 +00:00
Louwrentius f1ccfd2457 backup fixing distributed PPSS 2010-06-13 22:09:21 +00:00
Louwrentius 8eec8287f0 backup 2010-06-13 21:39:25 +00:00
Louwrentius f85f7b6d03 backup 2010-06-13 14:39:04 +00:00
Louwrentius b133b76ddf improved unit test 2010-06-08 23:10:35 +00:00
Louwrentius 4b9df537a0 Major rework started on unit tests (ppss-test.sh) 2010-06-06 20:45:56 +00:00
Louwrentius 708803688f PPSS can now be sourced for unit testing. 2010-06-06 18:02:05 +00:00
Louwrentius 40b3ed8228 Fixed distributed processing after replacing ARRAY mechanism with sed. 2010-05-15 22:50:51 +00:00
Louwrentius 9d92350f4b Major rework, no longer using arrays. Arrays don't scale and require enormous amounts of memmory when processing large input files. Will be released as 2.70. 2010-05-14 22:13:54 +00:00
Louwrentius 0db3781021 Major rework, no longer using arrays. Arrays don't scale and require enormous amounts of memmory when processing large input files. Will be released as 2.70. 2010-05-14 22:10:29 +00:00
Louwrentius 9feea3fb59 Fixed some item name escaping when containin < or > characters 2010-05-14 15:54:28 +00:00
Louwrentius 7c2d336dba Backup - fixed distributed processing, improved error handling. 2010-05-14 12:00:04 +00:00
Louwrentius 61d8a24ed2 Switched ppss over to md5 checksumming. (backup) 2010-05-14 02:07:43 +00:00
Louwrentius 825d7ed0a1 Cleaned up daemon mode. 2010-05-13 23:14:27 +00:00
Louwrentius 2cae93e7ce Improved daemon mode, but may be buggy and display output is a mess. 2010-04-15 22:13:02 +00:00
Louwrentius 13e6b77c65 Added daemon mode. 2010-04-15 21:46:27 +00:00
Louwrentius 7c9da647b5 Backup, added break after mode check, some cleanups 2010-04-14 21:22:04 +00:00
Louwrentius 2dcaced13b Added -q quiet option. 2010-04-10 22:38:02 +00:00
Louwrentius 38812a58b6 Added -q quiet option. 2010-04-10 22:35:22 +00:00
Louwrentius cf3b54e61e Updated help pages. 2010-04-03 17:33:58 +00:00
Louwrentius 8b7944dad7 Added support for reading from stdin. 2010-04-03 16:55:36 +00:00
Louwrentius 3f1b96e1bb Cleaned up Solaris fix. 2010-03-26 22:36:36 +00:00
Louwrentius bdaab0afe3 Fixed support for Solaris 10 2010-03-26 22:12:12 +00:00
Louwrentius efd6f72a5e Cleaned up some code, added some comments. Released as 2.60. 2010-03-20 22:25:07 +00:00
Louwrentius 7df68e7658 Cleaned up the PPSS help page. 2010-03-08 09:21:25 +00:00
Louwrentius f0ca726f28 Updated help page with information about the Amazon EC2 options. 2010-03-08 08:15:03 +00:00
Louwrentius 806f17c2dc Updated help page with information about the Amazon EC2 options. 2010-03-08 08:14:40 +00:00
Louwrentius 2c595ce846 Version 2.60b1 2010-03-07 23:17:16 +00:00
Louwrentius 283c93f871 Fixed isssue when using NFS for file transport. 2010-03-07 22:29:21 +00:00
Louwrentius ea33b0f0e7 Distributed ppss is working again for 99% 2010-03-07 20:47:51 +00:00
Louwrentius 0109e1fa3c Backup.. 2010-03-07 19:48:00 +00:00
Louwrentius 831e008e11 Backup, fixing distributed processing. Seems to work now. 2010-03-07 17:34:12 +00:00
Louwrentius 54c898f202 Backup, fixing distributed processing. Major rework. 2010-03-07 15:51:18 +00:00
Louwrentius 0f8dced209 Backup 2010-03-06 23:26:07 +00:00
Louwrentius 789db609c9 Fixed ec2 error on non-ec2 deployment 2010-03-01 22:07:19 +00:00
Louwrentius d1685d297c Incorporated the EC2 patch from Sean M. Collins 2010-03-01 21:43:22 +00:00
Louwrentius d5ea910e05 Backup... 2010-02-18 20:48:25 +00:00
Louwrentius a63973fe73 backup... 2010-02-18 19:47:39 +00:00
Louwrentius cda2c7b5c1 Backup... 2010-02-18 19:37:07 +00:00
Louwrentius 53deba3d63 PPSS now reports total processing time. 2010-02-13 23:00:49 +00:00
Louwrentius a2fdbba0c4 Update. 2010-02-10 23:54:09 +00:00
Louwrentius 365705e8c7 Released version 2.56b2 2010-02-09 22:01:05 +00:00
Louwrentius 9790e52c89 Fixed test script. 2010-02-07 21:40:25 +00:00
Louwrentius 50de3d4fdf Added example script flac2mp3 that can be used recursively on a flac collection to convert it to mp3. 2010-02-07 21:35:13 +00:00
Louwrentius 4d5324e7c8 Version number bump. 2010-02-07 21:34:05 +00:00
Louwrentius a9b4eac886 PPSS now processes directories recursive\!\!\! 2010-02-07 21:33:27 +00:00
Louwrentius bd97eed1ea Fixed test script. 2010-02-07 19:31:12 +00:00
Louwrentius 081337c5b2 Fixing file name excape bug... 2010-02-07 19:14:48 +00:00
Louwrentius 2356f6bb0a Merge distributed PPSS back into trunk 2010-01-31 22:31:22 +00:00
Louwrentius 83bc8fbf06 I hope i merged properly... 2009-03-10 20:01:08 +00:00
Louwrentius 121f1e5779 merged branch for distributed PPSS in trunk. 2009-03-10 19:54:20 +00:00
11 changed files with 3848 additions and 2994 deletions

1
README.md Normal file
View File

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

94
flac2mp3.sh Executable file
View File

@ -0,0 +1,94 @@
#!/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"

3228
ppss

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,35 @@
#!/bin/bash
DEBUG="$1"
VERSION=2.55
TMP_DIR="ppss"
PPSS=ppss
VERSION="2.98"
TMP_DIR="/tmp/ppss"
PPSS=./ppss
PPSS_DIR=ppss_dir
export PPSS_DEBUG=1
HOST_ARCH=`uname`
SPECIAL_DIR=$TMP_DIR/root/special
. "$PPSS"
cleanup () {
for x in $REMOVEFILES
do
if [ -e ./$x ]
then
rm -r ./$x
fi
done
unset RES1
unset RES2
GLOBAL_COUNTER=1
if [ ! "$DEBUG" = "debug" ]
then
for x in $REMOVEFILES
do
if [ -e ./$x ]
then
rm -r ./$x
fi
done
fi
if [ ! -z "$TMP_DIR" ] && [ -e "$TMP_DIR" ]
then
rm -rf "$TMP_DIR"
fi
}
parseJobStatus () {
@ -24,45 +39,38 @@ parseJobStatus () {
RES=`grep "Status:" "$JOBLOG/$TMP_FILE"`
STATUS=`echo "$RES" | awk '{ print $2 }'`
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 () {
NORMALTESTFILES=`echo test-{a..z}`
SPECIALTESTFILES="\'file-!@#$%^&*()_+=-0987654321~\' \'file-/\<>?:;'{}[]\' file-/\/\:\/!@#$%^&*()_+=-0987654321~ file-/\<>?:;'{}[] http://www.google.nl ftp://storage.nl"
JOBLOG=./$PPSS_DIR/job_log
INPUTFILENORMAL=test-normal.input
INPUTFILESPECIAL=test-special.input
INPUTFILESPECIAL_DIR=test-special.input
LOCALOUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT
REMOVEFILES="$PPSS_DIR test-ppss-*"
REMOVEFILES="$INPUTFILENORMAL $INPUTFILESPECIAL $PPSS_DIR test-ppss-*"
if [ ! -e "$TMP_DIR" ]
then
mkdir -p "$TMP_DIR"
fi
cleanup
for x in $NORMALTESTFILES
do
echo "$x" >> "$INPUTFILENORMAL"
done
for x in $SPECIALTESTFILES
do
echo $x >> "$INPUTFILESPECIAL"
done
}
testVersion () {
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
assertEquals "Version mismatch!" "$VERSION" "$SCRIPT_VERSION"
}
rename-ppss-dir () {
@ -85,139 +93,191 @@ oneTimeTearDown () {
createDirectoryWithSomeFiles () {
A="File with Spaces"
B="File\With\Slashes"
ROOT_DIR=$TMP_DIR/root
CHILD_1=$ROOT_DIR/child_1
CHILD_2=$ROOT_DIR/child_2
mkdir "/tmp/$TMP_DIR"
for x in "$A" "$B"
if [ ! -e "$ROOT_DIR" ]
then
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
TMP_FILE="/tmp/$TMP_DIR/$x"
touch "$TMP_FILE"
touch "$ROOT_DIR/file-$x"
touch "$CHILD_1/file-$x"
touch "$CHILD_2/file-$x"
done
ln -s /etc/resolve.conf "$ROOT_DIR" 2> /dev/null
ln -s /etc/hosts "$ROOT_DIR" 2> /dev/null
}
testSpacesInFilenames () {
createSpecialFilenames () {
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
RES=$( { ./$PPSS -d /tmp/$TMP_DIR -c 'ls -alh ' >> /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
grep "SUCCESS" $JOBLOG/* >> /dev/null 2>&1
assertEquals "Found error with space in filename $TMP_FILE" "0" "$?"
rm -rf "/tmp/$TMP_DIR"
rename-ppss-dir $FUNCNAME
create_working_directory
export SRC_DIR=$DIR
init_vars > /dev/null 2>&1
get_all_items
}
testSpecialCharacterHandling () {
testRecursion () {
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"
init_get_all_items $TMP_DIR/root 1
RESULT=`get_item_count_of_input_file`
EXPECTED=32
assertEquals "Recursion not correct." "$EXPECTED" "$RESULT"
rename-ppss-dir $FUNCNAME
}
testSkippingOfProcessedItems () {
testNoRecursion () {
createDirectoryWithSomeFiles
init_get_all_items $TMP_DIR/root 0
RESULT=`get_item_count_of_input_file`
EXPECTED=12
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"
assertEquals "Recursion not correct." "$EXPECTED" "$RESULT"
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
rename-ppss-dir $FUNCNAME
}
testExistLogFiles () {
testGetItem () {
./$PPSS -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null
assertEquals "PPSS did not execute properly." 0 "$?"
createSpecialFilenames
init_get_all_items $TMP_DIR/root 1
get_item
if [ -z "$ITEM" ]
then
ERROR=1
else
ERROR=0
fi
EXPECTED=0
assertEquals "Get item failed." "$EXPECTED" "$ERROR"
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"
i=1
ERROR=0
while get_item
do
((i++))
done
EXPECTED=40
assertEquals "Got wrong number of items." "$EXPECTED" "$i"
rename-ppss-dir "$FUNCNAME-$EXPECTED"
rename-ppss-dir $FUNCNAME
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
}
testErrorHandlingOK () {
testInvalidProcessingOfitemVariable() {
getStatusOfJob SUCCESS
}
testErrorHandlingFAIL () {
getStatusOfJob FAILURE
createSpecialFilenames
init_get_all_items $TMP_DIR/root 1
COMMAND='echo $ITEM'
while get_item
do
commando "$ITEM"
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

14
ppss-wav2mp3.cfg Normal file
View File

@ -0,0 +1,14 @@
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

File diff suppressed because it is too large Load Diff

1116
shunit2 Normal file

File diff suppressed because it is too large Load Diff

26
test-normal.input Normal file
View File

@ -0,0 +1,26 @@
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

8
test-special.input Normal file
View File

@ -0,0 +1,8 @@
\'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

124
transcode2mp4.sh Executable file
View File

@ -0,0 +1,124 @@
#!/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

19
wav2mp3.sh Executable file
View File

@ -0,0 +1,19 @@
#!/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 "$?"