[mythtv-users] partial restore of database from backup

John Pilkington johnpilk222 at gmail.com
Mon Oct 21 17:05:55 UTC 2019


On 21/10/2019 16:45, James Abernathy wrote:
> 
> On 10/21/19 11:29 AM, Stephen Worthington wrote:
>> On Mon, 21 Oct 2019 10:59:06 -0400, you wrote:
>>
>>> Like many I do daily backup of my mythtv database. However, I've only
>>> used that backup when building a new setup of hardware that will
>>> hopefully be doing the same function as the old one, once the database
>>> is restored and the recordings copied to the right directories.
>>>
>>> What I'm doing now is different and not sure if the saved database can
>>> help.  I'm build an additional mythtv backend that will be used to
>>> record some of the same programs but it started with a clean database.
>>> Both backends are set to record for example "NCIS". My main backend has
>>> been recording those since the beginning of the series so when a rerun
>>> comes on it will not record it again because it once recorded it long
>>> ago, even though it's been watch and deleted.
>>>
>>> The new backend will recorded it because it has no history.  Some of the
>>> reruns are not tagged as such and using that record flag doesn't solve
>>> the problem.
>>>
>>> So my question is, can I export the record history of a program or all
>>> programs from one backend to another so the new backend will not waste
>>> time recording something that's already be seen?
>>>
>>> I know that there are easy ways to just delete the recording, but I'm
>>> curious if this can be done.
>>>
>>> There are several reasons I want to do this, but one is I want to avoid
>>> my wife deleting a program we both watch that I have not seen yet. The
>>> "watched" icon doesn't always get noticed by her.
>>>
>>> Jim A
>> The information you want is in the oldrecorded table.  But it is not
>> possible to just export that table from one database and expect it to
>> work in another database as things like the chanid values will not
>> refer to the same channel (unless you have also exported all the
>> channel data).  If you really know what you are doing, you might be
>> able to write some code that translated all the fields in the
>> oldrecorded table correctly to match the new database, but it would be
>> specific code for those two databases.
>>
>> If you really want to do this, the only easy way would be to create
>> the new system using a full backup of the old system, then adjust its
>> settings to match the new system's hardware (tuners, disk partitions,
>> ...).  Then you would need delete all the data you do not need (all
>> the recordings that are only on the old system, for example).  You
>> could just run find_orphans.py and let it tidy up the database for all
>> the missing recordings.
> 
> 
> Thanks, I agree with your suggestion of creating a fresh system, 
> restoring the system database and finding orphans.  Sound a lot easier. 
> The tuners are all OTA HDHR or Hauppauge WinTV Quad tuners so the data 
> on the channels should agree. they all use tv_grab_zz_sdjson_sqlite.
> 
> This is not critical, so if it screws up, I can restart the new system 
> without any issues. It's a combo FE/BE on a Raspberry PI 4B 4G. At this 
> point I can't find anything it can't do that my Core i7 backend can do. 
> Looking for a future backend when this old PC dies.  Certainly not going 
> to buy a new one for a backend as good as the Pi 4B is.
> 
> Jim A

Long ago I asked here about merging the databases of two boxes.  I got a 
reply that seemed to work, but was authoritatively warned of possible 
problems ahead.  They  happened, fortunately not (yet) catastrophically.

The 'recordedid', often used as a search key, is autoincremented 
independently in every system and was retained in the Bad Merge, so that 
matches found by 'Previously recorded' are quite often unrelated to the 
target.  That's usually obvious; other effects may still be lurking...

John P



More information about the mythtv-users mailing list