Project

General

Profile

RE: Re-Import Existing Recordings ยป importall.sh

Hiro Protagonist, 2020-05-08 02:41

 
1
#!/bin/bash
2
#
3
# Modify to suit
4
CONFIGDIR='/volume1/@appstore/tvheadend-testing/var/dvr/log/'
5
RECORDINGS='/volume1/TV/'
6

    
7
echo "Scanning logs and recordings"
8

    
9
COUNT=0
10

    
11
for FILE in $(find $RECORDINGS -name "*.ts" -o -name "*.mkv") ; do
12
    LOGFILE=$(grep ${FILE} $CONFIGDIR/dvr/log/* | cut -d ':' -f 1)
13
    if [ "$LOGFILE" ]
14
    then
15
      echo "Preparing to import $(basename $FILE) with log $(basename $LOGFILE)"
16
      #tvhimport.sh "${FILE}" -l $LOGFILE
17
    else
18
      echo "Preparing to import $(basename $FILE) with no log"
19
      #tvhimport.sh $COMMAND "${FILE}"
20
    fi
21
    let COUNT++
22
    if [ $COUNT -gt 5 ]; then
23
      exit 0
24
    fi
25
done
    (1-1/1)