[mythtv-users] myth.rebuilddatabase.pl usage

R. G. Newbury newbury at mandamus.org
Fri May 1 19:00:55 UTC 2009


Greg Woods wrote:
> On Fri, 2009-05-01 at 09:05 -0700, Brad Fuller wrote:
>> I tried to use myth.rebuilddatabase.pl but I get an error.
>> Can't find Time/Format.pm
> 
> I just went through this. You have to install Time::Format from CPAN.
> Perhaps there is a Gentoo package that has this; there wasn't for Fedora
> 10 and I had to go to CPAN. If you've never used CPAN before, you can
> find out about it at www.cpan.org

The chunk of script below will download and build the 2 required perl 
scripts. Works for Fedora and should require no changes for any other 
distro. Versions on CPAN as of about March 1, 2009

BUT! see the note after the script...


*******************
#!/bin/bash
  cd /tmp
  echo ""
  echo "          Install perl scripts needed by myth.rebuilddatabase.pl"
  echo "          Get Time::Format and install "
  echo ""
  echo ""

wget 
http://search.cpan.org/CPAN/authors/id/R/RO/ROODE/Time-Format-1.09.tar.gz

tar xzvf Time-Format-1.09.tar.gz
cd Time-Format-1.09
perl Makefile.PL
make && make install
  echo ""
  echo ""

cd /tmp
rm -rf Time-Format*

  echo "           Get Time::Date and install"

wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/TimeDate-1.16.tar.gz

tar xzvf TimeDate-1.16.tar.gz
cd TimeDate-1.16
perl Makefile.PL
make && make install
cd /tmp
rm -rf TimeDate*
  echo ""
  echo ""
  echo "    DONE!"

**************************


NOTE!  Unfortunately, myth.rebuilddatabase.pl does NOT determine and 
enter the file size into the myth database. The recorded file size is 
set at zero..
You have to fix this, at the moment, by hand. My use of the incantation 
in 'awk' is (shamelessly) stolen from someone who put it on the wiki. 
The mysql invovation is mine. In a script it would be invoked with 
something like
'myth.file.sizer.sh 2171_20090419012800.mpg

Of course, this *should* be included in the inner loop of 
myth.rebuilddatabase.pl, but I don't understand enough perl to be able 
to do it quickly, and have not invested the time in figuring out how to 
do it.

*******************
# myth.file.sizer.sh
# ANSWER:
# You can do something like this:
SIZE=`ls -l $1 | awk '{print $5}'`
echo "   File  $1  is  $SIZE bytes"

mysql -u mythtv -pmythtv mythconverg << EOF
update recorded set filesize = '$SIZE' where basename = '$1';
EOF

******************
Geoff


More information about the mythtv-users mailing list