<div dir="ltr"><div>Thanks so much.  I'll give it a try, maybe after some tweaks.</div><div>I don't see anything in mythimport about chanid or recordid, and so I assume those are left with the original values, which are probably random values in the target db.</div><div><br></div><div>The comments in mythsgu say</div><div><pre>##############################################################################
# Dependencies:
#   MythTV API interface: Utilities.py (only for MythTV v29 or below).<br></pre>and later<br></div><div><pre># Version: 0.5 2019-06-08
#   MythTV v30 compatibility update - use MythTV.services_api instead of
#   Utilities.py.<br><br></pre><pre>Just to check: if I'm running v30, Utilities.py is unnecessary, right?<br></pre><pre>BTW, my reading of the MariaDB docs is that if recordedid is set to 0 or NULL on export, it will automatically be filled in with an appropriate value on import.  <br>That might be a little easier than fiddling in mythimport.<br></pre><pre>There's currently a pull request to update the myth python code to python 3 with <a href="https://github.com/rcrdnalor/mythtv/tree/devel/python3">https://github.com/rcrdnalor/mythtv/tree/devel/python3</a>.<br></pre><pre>It looks promising, though I haven't tried it.<br></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 31, 2019 at 2:07 AM Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, 30 Dec 2019 21:40:17 -0800, you wrote:<br>
<br>
>I have multiple MythTV server installations, mostly not the current<br>
>version.  They all have recorded shows.  I would like to combine them all<br>
>into my current server, although there are some more modest goals that<br>
>would be useful.  I'm looking for advice on how to proceed.  I am<br>
>comfortable programming, including using SQL.<br>
><br>
>I can run the other installations in real or virtual machines, or I could<br>
>access the files directly.<br>
><br>
>It's mostly recordings of TV shows I want to combine.<br>
><br>
>There is quite a bit of information about this in the mailing list and the<br>
>wiki, but I haven't seen anyone offering a program that does this.<br>
><br>
>The intermediate goal would be to import the information on what shows I've<br>
>recorded into my current installation, so that I don't record stuff I<br>
>already recorded.<br>
><br>
>Among the advice:<br>
>1) First convert all databases into the current format.<br>
>2) Never modify the database with SQL directly.  Though I'm happy to use<br>
>python, with or without the services API, to delete a recording, it seems<br>
>unlikely I'll avoid working in SQL.<br>
><br>
>As to the main conversion, there have been a range of responses:<br>
>3) It's not possible.<br>
>4) Export and reimport the recorded (and maybe oldrecorded? oldprogram?)<br>
>tables.  The references to recording rules, channel ids, and other stuff<br>
>will be messed up, but the basic information should be there. (<br>
><a href="https://lists.gt.net/mythtv/users/442688" rel="noreferrer" target="_blank">https://lists.gt.net/mythtv/users/442688</a>)  If I copy the actual recordings<br>
>to the current server, I should be able to watch them.  My guess is that<br>
>pulling this off might require fiddling with the ids to avoid collisions.<br>
>Also, don't copy stuff marked as future.<br>
>5) Use some kind of myth or mysql database tool to dump the database, make<br>
>"adjustments" and import it.  The non-existence of a script that does this<br>
>suggests this is difficult.<br>
><br>
>4) seems attractive.  I am not interested in migrating things like the<br>
>channel and tuner setups or (probably) recording rules from old<br>
>installations, except insofar as it allows me to make sense of the info<br>
>I've migrated, e.g., what channel a recording is from.  I am somewhat<br>
>unclear on the roles of recorded, oldrecorded, program, and oldprogram* in<br>
>the system, and I've been somewhat puzzled by the fact that information in<br>
>fields  that are defined for these tables is sometimes missing (e.g.,<br>
>oldrecorded's season and episode are always 0, though recorded and  program<br>
>have the information).<br>
><br>
>I guess I can't just blow off chanid, recordid and programid since the<br>
>table definition requires them to be non-NULL.  I'm not sure if it requires<br>
>them to be valid foreign keys; <a href="https://www.mythtv.org/wiki/Development_guide" rel="noreferrer" target="_blank">https://www.mythtv.org/wiki/Development_guide</a><br>
>says they are, but "show create table" does not show any formal foreign key<br>
>constraints.  If such a constraint is in effect and the existing value is<br>
>out of range, it will cause an error.  Otherwise it will just be a random<br>
>bogus reference.   At any rate, recordedid would need to respect the<br>
>primary key constraint.<br>
><br>
>Does the information of which recording rule is associated with a<br>
>particular recording (the recordid field) matter, or is it just<br>
>informational?<br>
><br>
>A perhaps simpler version of 4 is the suggestion to use MythArchive to move<br>
>the recordings (see thread referenced earlier).<br>
><br>
>It is likely I have some recording of the same show/episode made on<br>
>different systems.  It is very unlikely the recordings will have been made<br>
>at the same time.<br>
><br>
>Thanks for any advice.<br>
>Ross<br>
><br>
>*Here's what I gather from the descriptions (<br>
><a href="https://www.mythtv.org/wiki/Category:DB_Table" rel="noreferrer" target="_blank">https://www.mythtv.org/wiki/Category:DB_Table</a>) of  recorded, program and<br>
>the old* versions: program holds listings of the last couple of weeks and<br>
>upcoming programs in the sense of a particular broadcast at a particular<br>
>time on a particular channel, so they are from the listings provider.<br>
>recorded has recordings actually made (or, maybe, attempted, or not done<br>
>because they were duplicates--those are definitely in oldrecorded) and<br>
>still available for viewing.  oldrecorded has everything in recordings +<br>
>recordings that were deleted + future recordings.  oldprogram has only the<br>
>title and time, and probably exists only to help myth decide if an upcoming<br>
>program is new.  Since it records only the title, not the subtitle, episode<br>
>info, or original airdate, I'm not sure how it has enough info to do even<br>
>that.<br>
<br>
I can help with moving recordings from one MythTV setup to a different<br>
one.  I have a tool I wrote for that.  It is part of my "mythsgu"<br>
Python program.  I have helped someone else do a bulk copy as you are<br>
wanting to do and it worked well.  It works the same way as<br>
mythexport/mythimport work (and uses mythimport at the receiving end),<br>
but does bulk copies.  It is able to do the copying while both MythTV<br>
systems are working as it checks for recordings (or playback) in<br>
progress and pauses the copying when it sees either system is busy.<br>
You do need to have file access (eg SAMBA or NFS) to the receiving PC<br>
from the transmitting PC.<br>
<br>
I have only thought about the oldrecorded table in passing - in<br>
theory, it would be possible to transfer the data from that to a<br>
different system, as long as the channels have the same callsigns in<br>
both.  But I have never had the need to do that, so I have not written<br>
any code.  It does not look to be too difficult a job, but you would<br>
have to work out what the oldrecorded.findid field refers to and<br>
transfer that as well.  The code for mythimport shows how to adjust<br>
things like chanid and recordid which are unique on one database, but<br>
would need to be changed to match the database they are being merged<br>
into.<br>
<br>
The publicly available versions of mythsgu and mythimport are<br>
available on my web server:<br>
<br>
<a href="http://www.jsw.gen.nz/mythtv/mythsgu" rel="noreferrer" target="_blank">http://www.jsw.gen.nz/mythtv/mythsgu</a><br>
<a href="http://www.jsw.gen.nz/mythtv/mythimport/mythimport" rel="noreferrer" target="_blank">http://www.jsw.gen.nz/mythtv/mythimport/mythimport</a><br>
<br>
In mythsgu, look at the "exportdir" and "copydir" commands.  Let me<br>
know if you want to try using it - I think I should be able to dig out<br>
the instructions I emailed the other person who used it.<br>
_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org" target="_blank">mythtv-users@mythtv.org</a><br>
<a href="http://lists.mythtv.org/mailman/listinfo/mythtv-users" rel="noreferrer" target="_blank">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a><br>
<a href="http://wiki.mythtv.org/Mailing_List_etiquette" rel="noreferrer" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
MythTV Forums: <a href="https://forum.mythtv.org" rel="noreferrer" target="_blank">https://forum.mythtv.org</a><br>
</blockquote></div>