Project

General

Profile

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

Hiro Protagonist, 2020-05-08 05:27

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

    
7
echo "Scanning logs and recordings"
8

    
9
COUNT=0
10

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