[mythtv-users] Bulk change of video metadata?

mythtv at blandford.net mythtv at blandford.net
Fri Mar 5 18:06:30 UTC 2010


On 03/05/2010 11:01 AM, Jack McGee wrote:
> I installed a new frontend and don't know what I did but it blew out the
> video data. The list was empty, I had to rescan.
>
> Really, the only metadata I lost was parental level, most were set to 4.
>
> I guess there are three ways to fix this:
>
> 1) go through Video Manager and change metadata one by one.
> 2) run some command through PHPMYADMIN or sql command line.
> 3) partial restore from a backup.
>
> I'm inclined to do #2, there are many videos.
> Can anyone point me to a command that will change all of them to level
> 4, and I can change whatever needs to be back to 1.


Hi Jack,

I keep my files in seperate directories and use this script.  Just 
change the update_dir path in the last couple lines.

Michael


#!
# Source mysql.txt to find out db information
if [ -f $HOME/.mythtv/mysql.txt ]; then
         . $HOME/.mythtv/mysql.txt
else
         echo "Couldn't locate mysql.txt"
         exit 1
fi

function update_dir {
         RATED_DIR="$1"
         SHOWLEVEL="$2"
         if [ ! -d "$RATED_DIR" ]; then
                 echo "No such directory: $RATED_DIR"
                 exit 1
         fi
         echo "UPDATE  videometadata SET showlevel=$SHOWLEVEL  WHERE 
filename LIKE '$RATED_DIR/%' ;" | mysql -u $DBUserName 
--password=$DBPassword -D $DBName -h $DBHostName
}

update_dir "/mythtv/video/Movies" 4
update_dir "/mythtv/video/KidShows" 1



More information about the mythtv-users mailing list