[mythtv-users] Backend Migration/Consolidation

Stephen Worthington stephen_agent at jsw.gen.nz
Fri May 23 02:42:45 UTC 2014


On Thu, 22 May 2014 21:55:47 +0100, you wrote:

>On 22/05/2014 21:39, Phil Roberts wrote:
>> Have started investigation moving three backends to a new single 
>> backend and wish to retain the 'oldrecorded' information from each.
>>
>> machine 1 - running myth 0.19.20060121-2  ( built from scratch - 6000+ 
>> recordings )
>> machine 2 - running myth 0.23 fixes ( mythbuntu )
>> machine 3 - running myth 0.25 fixes ( mythbuntu )
>>
>> machine 4 - new environment myth 0.27 fixes
>>
>> A mysqldump of oldrecorded from 0.23 and 0.25 results in dropping the 
>> database table before inserting the records.  That is not so difficult 
>> to resolve. ( remove the drop and ALTER instead of CREATE ) I think.
>
>You could:
>
>- dump the database from m1 to file
>- create a new database on m4
>- import m1 database file onto m4
>- start up myth on m4 so that it upgrades the schema
>- dump the new m4 database to file
>- drop the database on m4
>... and repeat for m2 and m3
>
>Then you have three database files that have identical schemas 
>(compatible with 0.27) and how you merge them is a lot easier (although 
>not nice).
>
>I'm sure that someone on here will know a better myth-centric way, but ...
>
>Nige.

That is the way I would go about it.  I would use a VirtualBox virtual
PC to do it, with a clean install of Mythbuntu at the level you want
to upgrade to (14.04 and MythTV 0.27 ?).  I would keep a copy of the
virtual PC files after the install was complete, so I could clone them
to create a different virtual PC for each copy of the database I was
upgrading, and then restore a copy of the old database and allow the
virtual machine to do the upgrade, then do a full backup of the
resulting database.  That should give you 0.27 versions of all three
databases.  Then I would pick one of those and restore that into the
new system to use as the base database, and then merge the data from
the other systems into it.  I have never merged oldrecorded databases
before, so you would have to work out how to do that safely, but you
would have full working 0.27 databases to work from in each case, and
a virtual machine to run each database on if you need to play around
with them before trying to merge them.

If you wanted to keep all the old recordings from all three systems,
then I would recommend installing mythexport on the virtual PCs and
using it to export the required database for the recordings.  It knows
what needs exporting, rather than you having to work it out. You can
just go to its web page and tell it to export all the recordings
(ticking each recording will take a while, so it might be an idea to
modify the mythexport code somehow to do that automatically).  Then
tell mythexport to go ahead and start exporting, and kill it when it
starts to try to actually copy the recording files (which will not
work as they will not be on the virtual PC).  It only does that after
it has finished writing out a .sql file with all the data about the
recordings being exported.  Then you can use mythimport on the new
system to import that .sql file, and move the hard drives containing
the old recordings to the new system and either just point a storage
group to them, or copy the recording files to an existing storage
group.

As for merging oldrecorded databases, on a quick look I would say your
main problem would be changing the chanid values to match the channels
on the new system you are importing the data into.  I would be
possible to do some SQL code to do most of that work, using the data
from the three old databases and matching it against the new database.
Any other fields that refer to other database tables would also need
to be matched up, station for sure (matching to the channel.callsign
field), and possibly also findid and recordid - I am not really sure
what those two do.  To the best of my knowledge, all the other fields
do not refer to anything else in other database tables.  I think he
metadata tables refer back to the season and episode fields, but it
would probably be easier to just download a full new set of metadata
to recreate the metadata tables rather than trying to import all of
that.

When importing from oldrecorded, make sure you exclude all rows with
the future flag - those are data from the guide data, not data about
old recordings.

Good luck - it looks like a doable job, but it will take you a while.


More information about the mythtv-users mailing list