2010-02-08, 04:54
barney_1 Wrote:I took this idea and modified it a bit to work for me. I wrote a comanion script for mythical librarian that will delete symlinks and the database entry that accompanies them:
I then just added a command to execute this script. I added this to mythicalLibrarian.sh in the "MOVE" section, after the Success message is written:Code:#!/bin/sh
### myth-remove-from-library.sh - Use to remove a sym-linked mythtv recording and it's database entries
#Grab command line arguments
VIDEODIR=$1
FILENAME=$2
#Make sure we got command line arguments
if [ -z "${VIDEODIR}" -o -z "${FILENAME}" ]; then
echo "Usage: $0 <VideoDirectory> <FileName> "
exit 5
fi
#Test that input files exists and is a symbolic link (we don't want to delete actual recordings)
if [ ! -h "${VIDEODIR}/${FILENAME}" ]; then
echo "File does not exist or is not a symbolic link: ${VIDEODIR}/${FILENAME}"
exit 6
fi
#Remove recording entry from 'mythconverg' mysql database
echo "Removing ${FILENAME} from recorded table"
cat << EOF | mysql -u mythtv -pmythtv mythconverg
DELETE FROM
recorded
WHERE
basename = '${FILENAME}';
EOF
#Remove symblink file and thumbnails
echo "Removing ${FILENAME} file and thumbnails"
rm -f ${VIDEODIR}/${FILENAME}
rm -f ${VIDEODIR}/${FILENAME}.*
exit 0
Works like a charm. Now I know that any videos still hanging out in the mythtv recordings are not being recognized by mythical librarian and need to be moved manually.Code:...
#Send notification to daily report log
dailyreport "$ShowFileName"
echo "@@@@@@@@@@@@@OPERATION COMPLETE" `date` "@@@@@@@@@@@@@@@@">>"$mythicalLibrarian"/output.log
#Use script to remove the sym-link and database entry from mythtv
/home/mythtv/myth-remove-from-library.sh "`dirname "$3"`" "`basename "$3"`"
exit 0
...
I could add this in as a function for "SYMLINK=Disabled", with your permsision of course.