LinHES Forums
http://forums.linhes.org/

Importing TV recordings only
http://forums.linhes.org/viewtopic.php?f=6&t=6748
Page 1 of 1

Author:  haan [ Thu Nov 03, 2005 3:29 am ]
Post subject:  Importing TV recordings only

I've been running KnoppMyth for about a year and a half now and me and my family are really happy with it.
We are currently running R4V3 and that one was upgraded from an even older version.
Ive been testing to do "upgrades" to R5A16 but after restoring everything gets messed up. So now i'm trying to move the recordings only.

I have now done a clean install on a spare HD of R5A22 and it worked really nice. I've moved my videofiles and the content of /myth/tv to the new drive. I then followed the steps in the documentation on this link.

http://www.mythtv.org/docs/mythtv-HOWTO-23.html#ss23.7

Doing the mysqldump and extracting the data to a "restore.sql" file works fine (no errormessages) and the file is about 40MB.

But restoring the database on the new system using the following command gives me this errormessage.

Code:
root@tevis:~# mysql -u mythtv -pmythtv mythconverg < restore.sql
ERROR 1054 at line 1: Unknown column 'recorddups' in 'field list'


Has the format of the datrabase changed? Is this something that can be easily fixed?
I have searched the forum and wiki but not found any solution to this problem.

Regards
håkan

Author:  cesman [ Thu Nov 03, 2005 10:37 am ]
Post subject: 

Normally, the schema is changed between releases. I cannot recall having an issue but it has been a long time.

Author:  haan [ Thu Nov 03, 2005 4:07 pm ]
Post subject: 

I've compared the dumps from both my old and my new system and there are quite a few changes.

old-->INSERT INTO record (recordid, type, chanid, starttime, startdate, endtime, enddate, title, subtitle, description, category, profile, recpriority, autoexpire, maxepisodes, maxnewest, recorddups, preroll, postroll)
new-->INSERT INTO record (recordid, type, chanid, starttime, startdate, endtime, enddate, title, subtitle, description, category, profile, recpriority, autoexpire, maxepisodes, maxnewest, startoffset, endoffset, recgroup, dupmethod, dupin, station, seriesid, programid, search, autotranscode, autocommflag, autouserjob1, autouserjob2, autouserjob3, autouserjob4, findday, findtime, findid, inactive, parentid, transcoder, tsdefault)

old-->INSERT INTO oldrecorded (chanid, starttime, endtime, title, subtitle, description, category)
new-->INSERT INTO oldrecorded (chanid, starttime, endtime, title, subtitle, description, category, seriesid, programid, findid, recordid, station, rectype, duplicate, recstatus)

old-->INSERT INTO recordedmarkup (chanid, starttime, mark, offset, type)
new-->INSERT INTO recordedmarkup (chanid, starttime, mark, offset, type)


I've also tried to edit the dumpfile to allow it to be imported to the new DB but that seems tricky. I removed "recorddups, preroll and postroll" and the corresponding records.

Author:  Ralph [ Mon Jan 02, 2006 7:00 am ]
Post subject: 

haan, I am having the identical issue. Did you find a solution?

Author:  haan [ Mon Jan 02, 2006 8:03 am ]
Post subject: 

I'm afraid not. I still have my old recordings on another disk but I think I will erase them soon.
I'm sure it would be possible to fix if I spent a week or so, but I havent got that kind of energy right now.

Author:  Ralph [ Mon Jan 02, 2006 3:49 pm ]
Post subject: 

OK, thanks. If I have success I will post here to let you know how.
So that I don't cover the same ground you already have, what did you use to try to edit the dump file?
It seems to be a CSV (comma separated variable) file, and so should be editable in Excel, except that the file is too big for Excel - does anyone know what else one can use to edit large CSV files?

Author:  mad_paddler [ Mon Jan 02, 2006 5:22 pm ]
Post subject: 

How big is it exactly?

You could try the spreadsheet app in open office. Failing that you could edit it by hand in notepad or wordpad :S

Author:  Ralph [ Mon Jan 02, 2006 5:52 pm ]
Post subject: 

Mine is 14.6MB. If I rename 'restore.sql' to be 'restore.csv' then I can open it in Excel, but Excel warns "File not loaded completely" and it only displays the first 65,536 rows, which is about half of the file.
Perhaps I could cut the file in half using Notepad or Word, open each half in Excel, edit, then recombine...would need to get the edit points exactly right though or no doubt the whole thing would end up corrupted.

Author:  Ralph [ Tue Jan 03, 2006 1:25 am ]
Post subject: 

It seems that when the database schemas are different, it's not possible to restore from the "restore.sql" referenced at http://www.mythtv.org/docs/mythtv-HOWTO-23.html#ss23.7

I got around it this way…

First make a backup:
Code:
$ mysqldump mythconverg -c > mythtv_backup.csv


Then extract the data that is relevant to the programs:
Code:
$ grep "INSERT INTO record "         mythtv_backup.csv > record.csv
$ grep "INSERT INTO recorded "       mythtv_backup.csv > recorded.csv
$ grep "INSERT INTO oldrecorded "    mythtv_backup.csv > oldrecorded.csv
$ grep "INSERT INTO recordedmarkup " mythtv_backup.csv > recordedmarkup.csv


(See the note at the link above re. the newer versions of mysqldump placing backticks around the table names, and make appropriate changes if required.)

At this point you can open the new CSV files in Excel and edit them with regard removing certain columns, and/or renaming data, eg. replacing "preroll" & "postroll" in record.csv with "startoffset" & "endoffset" respectively. I also found that there are some errors which need to be corrected with regard to data in some rows being offset by one or two columns to the right, not absolutely sure why, but it was easy enough to correct this with cut/paste drag/drop in Excel.

I actually found that I only needed to edit two of the files, record.csv & recorded.csv, as the other two imported back without errors (see instructions in next para). Luckily this meant that the huge file, recordedmarkup.csv, did not have to be opened in Excel (which can't handle files with more than 65,536 rows).

So, finally, restore the information about your programs back into the database:
Code:
$ mysql mythconverg < record.csv
$ mysql mythconverg < recorded.csv
$ mysql mythconverg < oldrecorded.csv
$ mysql mythconverg < recordedmarkup.csv


I ended up with a lot of errors in my sql syntax, but luckily when you try to restore, it warns you of these - unfortunately only one by one, which means you need to keep going back to edit out each error as you find out about it (I actually found Notepad was more efficient than Excel when it came to fixing minor glitches like these).

The most annoying thing I found, apart from that, was that once I had edited and was ready to re-import into mythconverg, first it was necessary to trash the contents of the appropriate table(s) (ie. 'recorded' and/or 'record') because it was not possible to import data into a table that already had data in it - I got errors about "duplicate data". The upshot of this, of course, is that I do not have any of the data from the new machine remaining - only what was on the old machine. This is what I wanted, as there was only test data on the new box anyway - but if you have data on your new box that you need to keep as well as the old data you are importing, you may need to approach this a little differently.

Sorry if the last two paras don't make a lot of sense - but I'm a complete newbie at all this, so I'm just glad I managed to get this far! Anyway, the upshot of it all is, now my new system has all my old recordings, as well as all the old data I've compiled over the last few months regarding stuff I want to record in the future, whenever it's broadcast again.

Hope this helps, håkan!

Author:  Ralph [ Fri Jun 09, 2006 8:15 pm ]
Post subject:  If you changed the hostname

Additionally, if the database you are importing has a different hostname to your new machine, once you've done all this you'll also need to change the hostname in your imported database to match your machine. The only reliable way to do this is to follow the instructions in the MythTV docs. At the time of writing, this is under Section 21.15 "Changing your hostname".

If you don't do this, you'll experience issues in MythWeb with regard to thumbnail images not appearing, and very slow screen refresh times when viewing the 'Recorded Programs' screen as a result, as MythWeb will try to create thumbnails but will fail each time. (There may also be other issues that I'm not aware of, but I didn't experience any apart from that.)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/