[mythtv-users] re-introducing old recordings to a new setup

R. G. Newbury newbury at mandamus.org
Sun Jan 24 01:37:14 UTC 2016


On 01/23/2016 07:42 PM, HP-mini wrote:
> On Sat, 2016-01-23 at 14:42 -0700, Jerome Yuzyk wrote:
>>
>>
>> Before I migrated from 0.21 to 0.27 I saved a few recordings off to
>> the side by copying and renaming them, still keeping the .mpg
>> extension - I did no transcoding. They were movies that I had edited
>> to down to scenes with a car or cars I'm interested in.
>>
>>
>>
>> How can I re-introduced those recordings to my setup now? Ideally I'd
>> like to have a show name like "My Shows" and keep them with my other
>> recordings as episodes. I don't use MythVideo so I'd prefer to avoid
>> using that and keep everything visible in Watch Recordings.
>>
>>
>>
>> Could that be possible?
>>
> Too late now but mytharchive (to a file) is an excellent & overlooked
> feature that allows you to export/import recordings into anyone's mythtv
> recording dB.
>
> There are old scripts that attempt to create the necessary dB table
> entries (to import as recording). I can't locate one right now.

I have been using myth.rebuilddatabase.pl for many years. It finds files 
in the directory which are NOT included in the db, and leads you through 
entering the necessary info: giving a channel number, title, sub-title, 
and file name. The file name is the channel number+date+time and the 
file on disk will be re-named to that name..

One problem: the script as written does not enter the file size in the 
mythconverg db so mythfrontend cannot see it. And it borks if there is 
an existing file with the exact same channel number+date+time (just add 
a second to the time!).

The following little script (myth-filesizer) will put the correct file 
size in the db.

#!/bin/bash
#Default variables: amend as necessary
DBF="/var/lib/mysql"    #where the mysql db lives
VIDEO="/video/movies"
USER="mythtv"
PASSWORD="mythtv"
DB="mythconverg"
TMPFILE="/var/lib/mysql/tmpfile"

rm -f $TMPFILE
cd $DBF

mysql -u $USER -p$PASSWORD $DB << EOF
   select basename into outfile "$TMPFILE" from recorded where filesize 
= "0";
EOF
COUNT=`cat /var/lib/mysql/tmpfile | wc -l`
echo "Files to be fixed total "$COUNT

# the work gets done here

for file in `cat $TMPFILE`; do
     SIZE=`ls -l $file | awk '{print $5}'`
     echo "   File  $file  is  $SIZE bytes"
     mysql -u $USER -p$PASSWORD $DB << EOF
       update recorded set filesize = '$SIZE' where basename = '$file';
EOF
done
rm -f $TMPFILE


Geoff



More information about the mythtv-users mailing list