File epgsearch-1.0.1.beta5-fix-bashisms.patch of Package vdr-plugin-epgsearch
diff -Ndur epgsearch-1.0.1.beta5/scripts/mtdone2epgsearchdone.sh epgsearch-1.0.1.beta5-fix-bashisms/scripts/mtdone2epgsearchdone.sh
--- epgsearch-1.0.1.beta5/scripts/mtdone2epgsearchdone.sh 2013-03-16 21:54:35.000000000 +0200
+++ epgsearch-1.0.1.beta5-fix-bashisms/scripts/mtdone2epgsearchdone.sh 2014-11-19 02:12:32.939290058 +0200
@@ -36,14 +36,14 @@
PrevTitle=""
Count=0
-function ShowUsableSIDs()
+ShowUsableSIDs()
{
printf "\n"
grep -v "^#" $EPGSEARCH_FILE | sort -t':' -k2 | awk -F':' '{ print $1"\t"$2 }'
printf "\n"
}
-function AddRecToDone()
+AddRecToDone()
{
Rec=$1
Title=$(echo $Rec|cut -f1 -d'|')
@@ -53,7 +53,7 @@
if [ "$ASK_SID" = "yes" ]; then
if [ "$Title" != "$PrevTitle" ]; then
- [ $Count -gt 10 ] && Count=1 || let Count++
+ [ $Count -gt 10 ] && Count=1 || Count=$((Count + 1))
[ $Count -eq 1 ] && ShowUsableSIDs
printf "Adding \"%s, %s\".\n" "$Title" "$Subtitle"
printf "Enter S-ID (s=skip, ENTER=$DEFAULT_SID): "
@@ -63,7 +63,7 @@
printf "S-ID is set to $NEW_SID for \"$Title\"\n\n"
fi
else
- let Count++
+ Count=$((Count + 1))
printf "Adding \"%s, %s\".\n" "$Title" "$Subtitle"
printf "Title matches, using same S-ID as before : $NEW_SID\n\n"
fi
diff -Ndur epgsearch-1.0.1.beta5/scripts/recordingdone.sh epgsearch-1.0.1.beta5-fix-bashisms/scripts/recordingdone.sh
--- epgsearch-1.0.1.beta5/scripts/recordingdone.sh 2013-03-16 21:54:35.000000000 +0200
+++ epgsearch-1.0.1.beta5-fix-bashisms/scripts/recordingdone.sh 2014-11-19 02:22:20.246321813 +0200
@@ -72,21 +72,21 @@
EPGSEARCH_FILE="$EPGSEARCH_HOME/epgsearch.conf"
PrevTitle=""
-function ShowUsableSIDs()
+ShowUsableSIDs()
{
printf "\n"
grep -v "^#" $EPGSEARCH_FILE | sort -t':' -k2 | awk -F':' '{ print $1"\t"$2 }'
printf "\n"
}
-function AddRecToDone()
+AddRecToDone()
{
Rec=$1
if [ -e "$Rec/info.vdr" ]; then
# Get ctime from recordingdir
if [ "$CTIME_FROM_RECORDING" = "yes" ]; then
CTIME="$(echo "$Rec" | sed 's#......\.rec/##;s#.*/##')"
- CTIME="$(date +%s -d"${CTIME:0:10} ${CTIME:11:2}:${CTIME:14:2}")"
+ CTIME="$(date +%s -d"$(expr substr "$CTIME" 1 10) $(expr substr "$CTIME" 12 2):$(expr substr "$CTIME" 15 2)")"
fi
# Find S-ID in info.vdr
S_IDAlt=`grep -s "^D .*s-id:" $Rec/info.vdr | sed -re 's/^D .*s-id: ([0-9]*).*/\1/'`
diff -Ndur epgsearch-1.0.1.beta5/scripts/recrep.sh epgsearch-1.0.1.beta5-fix-bashisms/scripts/recrep.sh
--- epgsearch-1.0.1.beta5/scripts/recrep.sh 2013-03-16 21:54:35.000000000 +0200
+++ epgsearch-1.0.1.beta5-fix-bashisms/scripts/recrep.sh 2014-11-19 02:32:51.884355964 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#------------------------------------------------------------------------------
# this script allows searching for a repeat of a recording using epgsearch
# add the following lines to your reccmds.conf
diff -Ndur epgsearch-1.0.1.beta5/scripts/undoneepgsearch.sh epgsearch-1.0.1.beta5-fix-bashisms/scripts/undoneepgsearch.sh
--- epgsearch-1.0.1.beta5/scripts/undoneepgsearch.sh 2013-03-16 21:54:35.000000000 +0200
+++ epgsearch-1.0.1.beta5-fix-bashisms/scripts/undoneepgsearch.sh 2014-11-19 02:32:05.617353463 +0200
@@ -52,7 +52,7 @@
Undone=false
-function CleanExit() {
+CleanExit() {
[ -e $TempFile ] && rm -f $TempFile
[ -e $EPGSEARCHDONE_WORK ] && rm -f $EPGSEARCHDONE_WORK
[ -e $EPGSEARCHDONE_WORK.undone ] && rm -f $EPGSEARCHDONE_WORK.undone
@@ -61,8 +61,8 @@
# Get "--" options
-while [ "${1:0:2}" = "--" ]; do
- eval ${1:2}=yes
+while [ "${1#--}" != "$1" ]; do
+ eval ${1#--}=yes
shift
done
@@ -130,8 +130,8 @@
fi
# Try one match after each other
- let Try=1
- let Match=1
+ Try=1
+ Match=1
while [ $Try -le $TitleCnt ]; do
printf "\nDoes $Try. entry match all criteria : "
@@ -146,10 +146,10 @@
fi
if [ $? -eq 0 ]; then
printf "YES, "
- let MatchLine=$(grep -m$Match -n "^T $Title$" $EPGSEARCHDONE_WORK |tail -n 1| cut -f1 -d ':')
+ MatchLine=$(grep -m$Match -n "^T $Title$" $EPGSEARCHDONE_WORK | tail -n 1 | cut -f1 -d:)
[ $DEBUG = yes ] && printf "\n\nMatching line : $MatchLine\n"
if [ $MatchLine -gt 3 ]; then
- let FirstLine=MatchLine-3
+ FirstLine=$((MatchLine - 3))
[ $DEBUG = yes ] && printf "First line of Recording : $FirstLine\n"
# First line OK ?
nice -n 19 head -n $FirstLine $EPGSEARCHDONE_WORK | tail -n 1 | grep -q "^r"
@@ -157,20 +157,20 @@
printf "\nERROR: something went wrong finding the First line of recording, quitting\n"
CleanExit
fi
- let MatchRLine=$(grep -m$Match -n "^r$" $TempFile |head -n 1| cut -f1 -d ':')
- let LastMatchLine=MatchLine+MatchRLine
+ MatchRLine=$(grep -m$Match -n "^r$" $TempFile | head -n 1 | cut -f1 -d:)
+ LastMatchLine=$((MatchLine + MatchRLine))
# Bugfix - if more than one result then results are separated by a "--" line
- grep -q "^--$" $TempFile && let LastMatchLine--
+ grep -q "^--$" $TempFile && LastMatchLine=$((LastMatchLine - 1))
[ $DEBUG = yes ] && printf "Last Matching line : $LastMatchLine\n"
- let TailLines=$(wc -l $EPGSEARCHDONE_WORK | cut -f1 -d' ')
+ TailLines=$(wc -l $EPGSEARCHDONE_WORK | cut -f1 -d' ')
nice -n 19 head -n $LastMatchLine $EPGSEARCHDONE_WORK | tail -n 1 | grep -q "^R "
if [ $? -ne 0 -a $LastMatchLine -lt $TailLines ]; then
printf "\nERROR: something went wrong finding the Last line of recording, quitting\n"
CleanExit
fi
- let TailLines=TailLines-LastMatchLine+1
+ TailLines=$((TailLines - LastMatchLine + 1))
[ $DEBUG = yes ] && printf "TailLines = $TailLines\n"
# Sanity check
@@ -189,18 +189,18 @@
fi
else
printf "NO, not undone\n"
- let Match++
+ Match=$((Match + 1))
if [ -z "$Subtitle" ]; then
printf "\nEPG DESCRIPTION from done (maybe it helps) :\n\n"
grep "^D " $TempFile | cut -c3- | tr '|' '\n'
fi
fi
- let Try++
+ Try=$((Try + 1))
done
if [ "$Undone" = "true" ]; then
- let WorkLines=$(wc -l $EPGSEARCHDONE_WORK | cut -f1 -d' ')
- let EpgsLines=$(wc -l $EPGSEARCHDONE_FILE | cut -f1 -d' ')
+ WorkLines=$(wc -l $EPGSEARCHDONE_WORK | cut -f1 -d' ')
+ EpgsLines=$(wc -l $EPGSEARCHDONE_FILE | cut -f1 -d' ')
[ $DEBUG = yes ] && printf "\nOld number of lines $EpgsLines, new $WorkLines\n"
if [ $EpgsLines -gt $WorkLines ]; then
cp -f $EPGSEARCHDONE_WORK $EPGSEARCHDONE_FILE