Compare commits
113 Commits
master
...
distribute
Author | SHA1 | Date | |
---|---|---|---|
|
0869dc92ac | ||
|
05945843f0 | ||
|
a4b5fdc7c1 | ||
|
43e68825a3 | ||
|
204537cd04 | ||
|
297f5eacb8 | ||
|
f3666a49d6 | ||
|
3abe84f218 | ||
|
24b368e734 | ||
|
7d0815528e | ||
|
f2ccafefc6 | ||
|
20e520e820 | ||
|
fffccc3e04 | ||
|
e91f54932c | ||
|
fedd72bf1c | ||
|
e4bdd59475 | ||
|
1b16eb62ee | ||
|
d08dc38761 | ||
|
cd4545d0c3 | ||
|
05801b6773 | ||
|
722b3b4ea6 | ||
|
4d28218ce4 | ||
|
b1af50040f | ||
|
5b840d33c3 | ||
|
207e875727 | ||
|
4a682daaae | ||
|
276e721c7e | ||
|
239e422354 | ||
|
fd7f32668e | ||
|
e7f158235a | ||
|
7a578ff88b | ||
|
e24cf063e9 | ||
|
fb3905ad11 | ||
|
9a880c313d | ||
|
3a8257e519 | ||
|
e402fa6936 | ||
|
24bdb33583 | ||
|
d2e6bf7c54 | ||
|
95eb2e0d07 | ||
|
1da1de4b18 | ||
|
7ca08b87cf | ||
|
815bb952c9 | ||
|
9b0e5fdec5 | ||
|
ebd7ca55b7 | ||
|
04847e14db | ||
|
64486cb710 | ||
|
e6d3539b51 | ||
|
a4f1107863 | ||
|
ac7192cfde | ||
|
7ae3f7c512 | ||
|
9e4a89e95f | ||
|
62059e887e | ||
|
66e04d8806 | ||
|
113f4d31cb | ||
|
64edfe79c1 | ||
|
be217ac168 | ||
|
49d54913f7 | ||
|
2f5b38aedd | ||
|
1e26cef172 | ||
|
046ba029dc | ||
|
e5dcc81930 | ||
|
d523525eca | ||
|
8b1e5fed9a | ||
|
bd75afbf41 | ||
|
b3ba085fbe | ||
|
d2a8a6e08d | ||
|
964648de7f | ||
|
3f6343318a | ||
|
71e8d829d9 | ||
|
aaae2dc713 | ||
|
3e5fbfd38f | ||
|
b1fa580a3e | ||
|
954d8632c1 | ||
|
c6161eb4b4 | ||
|
04f13096a4 | ||
|
244cfce933 | ||
|
c8f4a2caa0 | ||
|
4b45db3169 | ||
|
d0a2413f64 | ||
|
c0d58e6752 | ||
|
5317a82ac4 | ||
|
d8c73dba4b | ||
|
f6062bfdaf | ||
|
979b1cc0a4 | ||
|
ffeaf1ccf6 | ||
|
808d14e08c | ||
|
73d49b125b | ||
|
c3975dd64a | ||
|
0a35341033 | ||
|
1bdfe61490 | ||
|
02f0d7b4fa | ||
|
21114ec54a | ||
|
cca01f27fd | ||
|
f83f916c57 | ||
|
628e93c904 | ||
|
c231b8e05a | ||
|
6bd4d48a76 | ||
|
66a8983a3e | ||
|
aa15c6f868 | ||
|
f6b9fad83a | ||
|
af1eda73d4 | ||
|
7c16a77860 | ||
|
ed55ae5137 | ||
|
39c1ecf542 | ||
|
2edb204c4c | ||
|
bca4fda670 | ||
|
cacb489c14 | ||
|
fc5d48b73c | ||
|
2e76e5e34e | ||
|
0090a68d70 | ||
|
a8bb31a575 | ||
|
04501ea92a | ||
|
f7c2f34cb5 |
94
flac2mp3.sh
94
flac2mp3.sh
@ -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"
|
322
ppss-test.sh
322
ppss-test.sh
@ -1,22 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEBUG="$1"
|
||||
VERSION="2.98"
|
||||
TMP_DIR="/tmp/ppss"
|
||||
PPSS=./ppss
|
||||
VERSION=2.55
|
||||
TMP_DIR="ppss"
|
||||
PPSS=ppss
|
||||
PPSS_DIR=ppss_dir
|
||||
export PPSS_DEBUG=1
|
||||
HOST_ARCH=`uname`
|
||||
SPECIAL_DIR=$TMP_DIR/root/special
|
||||
. "$PPSS"
|
||||
|
||||
cleanup () {
|
||||
|
||||
unset RES1
|
||||
unset RES2
|
||||
GLOBAL_COUNTER=1
|
||||
if [ ! "$DEBUG" = "debug" ]
|
||||
then
|
||||
for x in $REMOVEFILES
|
||||
do
|
||||
if [ -e ./$x ]
|
||||
@ -24,12 +15,6 @@ cleanup () {
|
||||
rm -r ./$x
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -z "$TMP_DIR" ] && [ -e "$TMP_DIR" ]
|
||||
then
|
||||
rm -rf "$TMP_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
parseJobStatus () {
|
||||
@ -39,38 +24,45 @@ 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_DIR=test-special.input
|
||||
INPUTFILESPECIAL=test-special.input
|
||||
LOCALOUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT
|
||||
REMOVEFILES="$PPSS_DIR test-ppss-*"
|
||||
|
||||
if [ ! -e "$TMP_DIR" ]
|
||||
then
|
||||
mkdir -p "$TMP_DIR"
|
||||
fi
|
||||
REMOVEFILES="$INPUTFILENORMAL $INPUTFILESPECIAL $PPSS_DIR test-ppss-*"
|
||||
|
||||
cleanup
|
||||
|
||||
for x in $NORMALTESTFILES
|
||||
do
|
||||
echo "$x" >> "$INPUTFILENORMAL"
|
||||
done
|
||||
|
||||
for x in $SPECIALTESTFILES
|
||||
do
|
||||
echo $x >> "$INPUTFILESPECIAL"
|
||||
done
|
||||
}
|
||||
|
||||
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 () {
|
||||
@ -93,191 +85,139 @@ oneTimeTearDown () {
|
||||
|
||||
createDirectoryWithSomeFiles () {
|
||||
|
||||
ROOT_DIR=$TMP_DIR/root
|
||||
CHILD_1=$ROOT_DIR/child_1
|
||||
CHILD_2=$ROOT_DIR/child_2
|
||||
A="File with Spaces"
|
||||
B="File\With\Slashes"
|
||||
|
||||
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}
|
||||
mkdir "/tmp/$TMP_DIR"
|
||||
for x in "$A" "$B"
|
||||
do
|
||||
touch "$ROOT_DIR/file-$x"
|
||||
touch "$CHILD_1/file-$x"
|
||||
touch "$CHILD_2/file-$x"
|
||||
TMP_FILE="/tmp/$TMP_DIR/$x"
|
||||
touch "$TMP_FILE"
|
||||
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
|
||||
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
|
||||
RESULT=`get_item_count_of_input_file`
|
||||
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" ]
|
||||
assertNull "PPSS retured some errors..." "$RES"
|
||||
if [ ! "$?" == "0" ]
|
||||
then
|
||||
ERROR=1
|
||||
else
|
||||
ERROR=0
|
||||
echo "RES IS $RES"
|
||||
fi
|
||||
EXPECTED=0
|
||||
assertEquals "Get item failed." "$EXPECTED" "$ERROR"
|
||||
|
||||
i=1
|
||||
ERROR=0
|
||||
while get_item
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
((i++))
|
||||
assertTrue "[ -e $JOBLOG/$x ]"
|
||||
done
|
||||
EXPECTED=40
|
||||
assertEquals "Got wrong number of items." "$EXPECTED" "$i"
|
||||
|
||||
rename-ppss-dir $FUNCNAME
|
||||
cleanup
|
||||
}
|
||||
|
||||
return_all_items () {
|
||||
getStatusOfJob () {
|
||||
|
||||
while get_item
|
||||
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
|
||||
ALL_ITEMS="$ALL_ITEMS$ITEM"$'\n'
|
||||
STATUS=`parseJobStatus "$x"`
|
||||
assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS"
|
||||
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
|
||||
rename-ppss-dir "$FUNCNAME-$EXPECTED"
|
||||
}
|
||||
|
||||
|
||||
testInvalidProcessingOfitemVariable() {
|
||||
testErrorHandlingOK () {
|
||||
|
||||
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
|
||||
getStatusOfJob SUCCESS
|
||||
}
|
||||
|
||||
testErrorHandlingFAIL () {
|
||||
|
||||
getStatusOfJob FAILURE
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
@ -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
|
@ -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
|
@ -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
|
124
transcode2mp4.sh
124
transcode2mp4.sh
@ -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
|
||||
|
||||
|
||||
|
||||
|
19
wav2mp3.sh
19
wav2mp3.sh
@ -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 "$?"
|
Loading…
Reference in New Issue
Block a user