summaryrefslogtreecommitdiff
path: root/batch.sh
diff options
context:
space:
mode:
authorRichard <richard@ha-server.local>2016-09-04 11:27:10 +0100
committerRichard <richard@ha-server.local>2016-09-04 11:27:10 +0100
commitdb51d3bbfdd63d4c62ca718bfcd7467d2cdc6fa6 (patch)
tree0a2ada6f32615a2b4f7270b8d2a3e203bff3c1c5 /batch.sh
parent83632745c43d406856a3b9948cb5ea4a5ec22666 (diff)
downloadvdr-convert-db51d3bbfdd63d4c62ca718bfcd7467d2cdc6fa6.tar.gz
vdr-convert-db51d3bbfdd63d4c62ca718bfcd7467d2cdc6fa6.tar.bz2
Files not symlinks
Diffstat (limited to 'batch.sh')
-rwxr-xr-x[l---------]batch.sh59
1 files changed, 58 insertions, 1 deletions
diff --git a/batch.sh b/batch.sh
index 1d13ce5..4d1f5c2 120000..100755
--- a/batch.sh
+++ b/batch.sh
@@ -1 +1,58 @@
-/opt/data/develop/scripts/batch.sh \ No newline at end of file
+#!/bin/bash
+# Shell script to convert VDR recordings in todo.txt to mpeg4 files. No upload
+#------------------------------------------------------------------------------
+# Revision History
+#------------------------------------------------------------------------------
+#
+# $Log: batch.sh,v $
+# Revision 1.3 2016/09/01 13:08:06 richard
+# Pass multiple vdr-convert flags
+# Update VDR afterwards
+#
+# Revision 1.2 2014/12/11 15:24:41 richard
+# Improvements
+#
+# Revision 1.1 2014/12/10 10:44:19 richard
+# Initial import - as used in BKK 2014
+#
+#------------------------------------------------------------------------------
+
+# Usual way to create a "todo" list is as follows:
+# find $DIR -type d | grep -i '.rec$' > $DIR/todo.txt
+
+#Default directory where we work
+input='/mnt/lvm/TV'
+root=$input
+
+function usage {
+ echo "usage: $0 <vdr-convert args>"
+}
+
+function logit() {
+ logger -s -p local2.warn -t batch "$1"
+}
+
+#------------------------------------------------------------------------------
+# Start of script
+#------------------------------------------------------------------------------
+
+[ $# -eq 0 ] && usage && exit 1
+
+for arg in "$@";
+do
+ args="$args '$arg'"
+done
+
+# Timeout req'd for troublesome conversions where ffmpeg sometimes get stuck.
+# (NOTE Causes issues when run interactively.)
+NAMES="$(< $(pwd)/todo.txt)" #names from todo.txt file in this directory
+for NAME in $NAMES; do
+# /bin/su vdr -c vdr-convert -i "\"$NAME"\" $args"
+ timeout -k 5h 4h sh -c "vdr-convert -i "\"$NAME"\" $args"
+ [ $? -ne 0 ] && logit "Fail: problem converting $NAME"
+done
+
+#Ask VDR to re-read the files
+touch "$root/.update"
+
+# --------- $Id: batch.sh,v 1.3 2016/09/01 13:08:06 richard Exp $ ---------- END