[mythtv-users] Question about using backup myth mysql dumps...

Nick Rout nick.rout at gmail.com
Mon Nov 23 08:04:36 UTC 2009

On Mon, Nov 23, 2009 at 5:10 PM, stuart <stuart at xnet.com> wrote:
> Michael T. Dean wrote:
>> On 11/22/2009 10:34 PM, stuart wrote:
>>> Michael T. Dean wrote:
>>>> On 11/22/2009 07:41 PM, Nick Rout wrote:
>>>>> On Mon, Nov 23, 2009 at 1:12 PM, Michael T. Dean  wrote:
>>>>>> On 11/22/2009 12:28 PM, stuart wrote:
>>>>>>> In my hast, I have created a bunch of orphaned recordings (100+).
>>>>>>> Information about them still exists in the old mythtv data base, but
>>>>>>> I
>>>>>>> think putting the old mythtv data base back into mysql would be a
>>>>>>> mistake as the data base dump is months old. So, I've come to the
>>>>>>> conclusion the best thing to do is wade through the recordings,
>>>>>>> rename
>>>>>>> the keepers to something a human can read and place them into a
>>>>>>> mythtv
>>>>>>> video directory.
>>>>>>> However, I can't help but think it might be possible to still use the
>>>>>>> old mythtv data base dump to rename these files to something a human
>>>>>>> can read!  (That would be waaaay faster then spot checking them with
>>>>>>> video player!)
>>>>>>> Anyone have ideas on how to do this (i.e. use an old mysql data base
>>>>>>> dump to rename mythtv recordings)?
>>>>>> I'd argue that it would be better, easier, and you'd retain more and
>>>>>> better information if you restored the old database, then went through
>>>>>> and deleted all the shows whose files are missing.
>>>>> But what about shows that have been added into the database since the
>>>>> old database was backed up?
>>>> Don't you have a current database you can just back up?
>>> Why yes, but ... I don't remember seeing any mythtv howto's on merging
>>> old and new data base dumps.
>>> Also, (didn't want to bore you) I have cleaned up the recording rules a
>>> fair bit since the old data base dump (seams a lot of people were just
>>> pressing "record" in the program listings creating multiple rules for the
>>> same shows!).
>>> A friend suggested there might be a way to harvest each orphaned
>>> recording's information from the old data base and use "INSERT" to place the
>>> information into the new data base.  It is trivial to create a clean list of
>>> orphaned recording files.  What I don't know is how to extract from the old
>>> dump and insert into the new.
>> So the orphans are orphaned files for which someone deleted your database
>> metadata?
>> Mike
> Yes,
> I most likely ran myth.find_orphans.pl w/the
> delete-data-base-entry-if-you-cant-find-a-file option and somehow erased the
> data base entries of 100+ files. Since then I have spent time cleaning up my
> recording rules plus now there are 2 months of fresh recordings in the data
> base. I find it tantalizing that information still exists for these orphaned
> recordings in older data base dumps. But I am not sure how to selectively
> move each recording's information forward into the new data base.

Have you changed mythtv versions or gone to a new database schema
since the backup?

If not you can probably use

myth.find_orphans.pl|grep unknown

 to get a list of the orphaned files, then massage the filenames and
then write some sort of script to extract the appropriate lines from
from the recorded table in the backup, then insert those lines in your
current database.

I would proceed slowly and experimentally with plenty of backups of
your last known working database!!

It should be a relatively simple script, but don't ask me to do it!

One caution: I don't know what tables other than 'recorded' should
affected when you add the entries back!

More information about the mythtv-users mailing list