1
|
#!/bin/sh
|
2
|
|
3
|
INPUTVIDEO="$1" # Full path to recording, i.e. /home/user/Videos/News.ts
|
4
|
|
5
|
BASENAME=$(/usr/bin/basename "${INPUTVIDEO}" ".ts")
|
6
|
|
7
|
DIRNAME=`/usr/bin/dirname $INPUTVIDEO`
|
8
|
EDLFILE="$DIRNAME/$BASENAME.edl"
|
9
|
LOGFILE="$DIRNAME/$BASENAME.log"
|
10
|
TXTFILE="$DIRNAME/$BASENAME.txt"
|
11
|
LOGOFILE="$DIRNAME/$BASENAME.logo.txt"
|
12
|
COMSKIPPATH="/usr/bin/comskip"
|
13
|
COMSKIPINI="/var/snap/tvheadend/139/comskip/comskip.ini"
|
14
|
COMSKIPLOGS="/var/snap/tvheadend/139/comskip"
|
15
|
TVHEADENDPP="/var/snap/tvheadend/139/comskip"
|
16
|
|
17
|
CreateLog(){
|
18
|
echo "***** CREATE LOG *****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
19
|
echo "*****" > ${TVHEADENDPP}/tvheadendpp$$.log
|
20
|
echo "***** INPUT = $INPUTVIDEO *****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
21
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
22
|
}
|
23
|
|
24
|
FlagCommercials(){
|
25
|
echo "Starting Commercial Flagging" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
26
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
27
|
echo "***** OUTPUT = "$EDLFILE" *****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
28
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
29
|
/usr/bin/whoami >> ${TVHEADENDPP}/tvheadendpp$$.log # for debugging purposes, who is running this script?
|
30
|
echo "Started at `/bin/date`" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
31
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
32
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
33
|
|
34
|
$COMSKIPPATH --ini=$COMSKIPINI $INPUTVIDEO 2>&1 </dev/null >> ${TVHEADENDPP}/tvheadendpp$$.log
|
35
|
|
36
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
37
|
echo "*****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
38
|
|
39
|
echo "EDL for $INPUTVIDEO:" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
40
|
}
|
41
|
|
42
|
CleanUp(){
|
43
|
echo "***** CLEAN UP *****" >> ${TVHEADENDPP}/tvheadendpp$$.log
|
44
|
echo "[[ ! -f $LOGFILE ]] || /bin/mv $LOGFILE $COMSKIPLOGS"
|
45
|
echo "[[ ! -f $TXTFILE ]] || /bin/mv $TXTFILE $COMSKIPLOGS"
|
46
|
/bin/mv $LOGFILE $COMSKIPLOGS
|
47
|
/bin/mv $TXTFILE $COMSKIPLOGS
|
48
|
}
|
49
|
|
50
|
CreateLog
|
51
|
FlagCommercials
|
52
|
CleanUp
|
53
|
|
54
|
echo "Finished at `/bin/date`" >> ${TVHEADENDPP}/tvheadendpp$$.log
|