Project

General

Profile

How to remove duplicate recordings

Added by Mike A over 10 years ago

Hi,

I have found it a bit of a pain having duplicate recordings of things I have on auto record. I am forever manually deleting these as I could find no system way, or other method by googling. Anyway, I did this solution for myself so it's here if anyone else is interesting.

Basically, it moves a recording which it thinks is a duplicate to another folder (which may or may not be in your XBMC TV Shows library, what ever you prefer) and then purges these when they are 7 days old. As a nice extra, I also get it to email me when a recording is made telling me what is it. I really like this when something on auto kicks in and I didn't realise it was back on! :)

If anyone is interested, this is how I did it.

My recording live here;
/storage/tvheadend/video

My new folder for dups is here;
/storage/tvheadend/dups

Change your DVR settings to call the script;

Create this script as;
/home/hts/rem_if_dup.sh

#!/bin/bash
PATH=/bin:/usr/bin:$PATH export PATH

REC="$1" 
FILE="$2" 
[email protected]

echo "$3" | mail -s "Recording: $REC" $EMAIL

DUP=`echo "$REC" | grep "\-[1-9].mkv$"`

echo $DUP

if [ "$DUP" != "" ]
then
  echo "This may be a dupilicate recording and will be deleted soon" | \
    mail -s "DUPLICATE Recording: $REC" $EMAIL
  mv "$FILE" "/storage/tvheadend/dups" 
fi

find /storage/tvheadend/dups -mtime +7 -exec rm "{}" \;

It would be nice if this was in the core TvHeadend. Don't know if it's possible? As in two new settings;

[X] Email on recording complete
[X] Quarantine possible duplicate records

Just a suggestion. Anyway, works for me an it's here for anyone interested.