Cutinplace.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K (Zuordnung)
(M)
 
(12 dazwischenliegende Versionen von 9 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Script von [[cutinplace]].
+
Vorschlag für ein einfaches Skript um [[cutinplace]] zu ''starten'', welches über die [[reccmds.conf]] ausgeführt werden kann.
  
{{Box Datei | $PATH/cutinplace.sh |
+
{{Box Datei | [[Struktur|$PATH]]/cutinplace.sh |
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Zeile 7: Zeile 7:
 
# cutinplace.sh
 
# cutinplace.sh
 
#
 
#
# Required: at, cutinplace
+
# add this line to your reccmds.conf:
 +
# folgende zeile in die reccmds.conf eintragen:
 
#
 
#
# add this lines to your reccmds.conf:
+
# cutinplace : /path_to_this_script/cutinplace.sh
# folgende zeilen in die reccmds.conf eintragen:
+
#
+
# cutinplace (at) : /usr/local/bin/cutinplace.sh -at
+
# cutinplace      : /usr/local/bin/cutinplace.sh -start
+
  
# CONFIG START
+
which cutinplace >/dev/null 2>&1 || { echo cutinplace $"not found" ... ; exit 1 ; }
  MAX_IN_MB="600"  # max size -> cut without at
+
  MESSAGE="You need to set the Maximum recording size to 100MB or something small anyway in Recordings menu to fully enjoy faster cutting times."
+
# CONFIG END
+
  
PATH=$PATH:/usr/local/bin
+
MARKS=$(wc -l < "$1/marks.vdr" 2>/dev/null)
 
+
if [ ${MARKS:-0} -lt 2 ] ; then
I18N=${MYPATH:?}/VDR/i18n.c
+
    echo $"No editing marks defined" ...
LANGUAGE=( `grep -s ^OSDLanguage ${VDR_CONFIG:?}/setup.conf` )
+
else
MAXFILESIZE=`grep -s ^MaxVideoFileSize ${VDR_CONFIG:?}/setup.conf | cut -d' ' -f3`
+
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
 
+
read PID < "$PIDFILE"
VAR=${MAXFILESIZE##*[^0-9]*}
+
echo $"Cutinplace process already active" "(pid: $PID)" ...
eval ${VAR:+test $MAXFILESIZE -gt 100 && echo $MESSAGE}
+
    else
 
+
screen -dm sh -c \
case "$1" in
+
" \
    -at)
+
    cutinplace \"$1\" &
at now <<EOT
+
    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process started"" (pid: \$!) ...\" ; \
MESG_START="$(grep -sA ${LANGUAGE[2]} '"Editing process started",$' $I18N | tail -n1 | cut -d'"' -f2)"
+
    echo \$! > \"$PIDFILE\" ; \
MESG_END="$(grep -sA ${LANGUAGE[2]} '"Editing process finished",$' $I18N | tail -n1 | cut -d'"' -f2)"
+
    wait \$! ; \
svdrpsend.pl MESG "\${MESG_START:-Editing process started}" >/dev/null
+
    rm -f \"$PIDFILE\" ; \
cutinplace "$2" >/dev/null
+
    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process finished"" (pid: \$!) ...\" \
svdrpsend.pl MESG "\${MESG_END:-Editing process finished}" >/dev/null
+
"
EOT
+
    fi
;;
+
fi
    -start)
+
VAR=$(($(find "$2" -printf %k+)0))
+
if [ "$((VAR/1024))" -gt "$MAX_IN_MB" ] ; then
+
    echo "Record to large ($((VAR/1024))Mb -gt ${MAX_IN_MB}Mb), use better at..."
+
else
+
    cutinplace "$2"
+
fi
+
;;
+
esac
+
 
</pre>
 
</pre>
 
}}
 
}}
  
[[Kategorie:Scripts]]
+
==Quellen==
 +
* [[cutinplace]]
 +
 
 +
[[Kategorie:Skripte]]

Aktuelle Version vom 12. Juni 2006, 10:03 Uhr

Vorschlag für ein einfaches Skript um cutinplace zu starten, welches über die reccmds.conf ausgeführt werden kann.

Datei
$PATH/cutinplace.sh
#!/bin/sh
#
# cutinplace.sh
#
# add this line to your reccmds.conf:
# folgende zeile in die reccmds.conf eintragen:
#
# cutinplace : /path_to_this_script/cutinplace.sh

which cutinplace >/dev/null 2>&1 || { echo cutinplace $"not found" ... ; exit 1 ; }

MARKS=$(wc -l < "$1/marks.vdr" 2>/dev/null)
if [ ${MARKS:-0} -lt 2 ] ; then
    echo $"No editing marks defined" ...
else
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
	read PID < "$PIDFILE"
	echo $"Cutinplace process already active" "(pid: $PID)" ...
    else
	screen -dm sh -c \
	" \
	    cutinplace \"$1\" &
	    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process started"" (pid: \$!) ...\" ; \
	    echo \$! > \"$PIDFILE\" ; \
	    wait \$! ; \
	    rm -f \"$PIDFILE\" ; \
	    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"Cutinplace process finished"" (pid: \$!) ...\" \
	"
    fi
fi


[Bearbeiten] Quellen