Skip to content

Commit 71f963d

Browse files
more improved
1 parent 7eb7e0f commit 71f963d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

scripts/LoopConverter

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
EXT=ts
4+
5+
for i in *; do
6+
if [ "${i}" != "${i%.${EXT}}" ];then
7+
echo "convertible file found: $i"
8+
fi
9+
done
10+
11+
for i in *; do
12+
if [ "${i}" != "${i%.${EXT}}" ];then
13+
echo "converting file $i"
14+
convert "$i"
15+
fi
16+
done

scripts/convert

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
NOW=$(date +"%m%d%Y")
4+
PGMNAME=/usr/bin/HandBrakeCLI
5+
check_errs()
6+
{
7+
# Function. Parameter 1 is the return code
8+
# Para. 2 is text to display on failure.
9+
if [ "${1}" -ne "0" ]; then
10+
echo "ERROR # ${1} : ${2}"
11+
# as a bonus, make our script exit with the right error code.
12+
exit ${1}
13+
fi
14+
}
15+
16+
BASEPATH=$(dirname "$1")
17+
BASEFILE=$(basename "$1")
18+
FILENAME="${BASEFILE%%.*}"
19+
20+
echo "Starting $NOW"
21+
${PGMNAME} --input "$1" --format mkv --aencoder aac --ab 192 --encoder x264 --x264-preset veryfast --quality 23 --turbo --encoder-level 4.1 --output "$BASEPATH/$FILENAME.mkv"
22+
check_errs $? "Failed to convert file $1"
23+
24+
echo "Removing original file."
25+
rm -f "$1"
26+
check_errs $? "Failed to remove original file $1"
27+
28+
exit

0 commit comments

Comments
 (0)