I use a combination of a HDhomerun tuner by Silicon Dust and a PC with mythtv backend setup, the tuner is network based.
Problem is the hdhomerun only works with DHCP, no static IP setup. So what happens is when I have a power outage the unit resets and comes back with a different IP.
I know I should setup my own DHCP server instead of using my routers, but cbf
So, what was happening was when the IP changed my mythtv would still record…. But nothing was recorded.
So I wrote the following script which would log on to the database check the recorded files and compared them to the files in the directory. If it existed in the database and not in the directory it will remove the entry from the database.
It just works and keeps your mythtv db nice and clean.
mysql -u$username -p$password -D $database -e "select basename from recorded;" > $tempfile
for i in `cat $tempfile| grep -v "basename"`
if [ -a $recordings/$i ]
echo "Exists - $i"
echo "Deleteing $i"
mysql -u$username -p$password -D $database -e "delete from recorded where basename = '$i';"