[mythtv-users] Copy frontend settings to new frontend keeping both

Hika van den Hoven hikavdh at gmail.com
Fri Oct 30 19:51:13 UTC 2015


Hoi Mike,

Friday, October 30, 2015, 7:21:35 PM, you wrote:

> On Mon, Oct 26, 2015 at 1:46 PM, Hika van den Hoven <hikavdh at gmail.com>
> wrote:

>> Try:
>> SELECT s1.value, s1.data AS old, s2.data AS new
>>         FROM settings as s1 JOIN settings as s2
>>         ON (s1.value = s2.value)
>>         WHERE s1.hostname = '<existing frontend name>'
>>         AND s2.hostname = '<new frontend name>'
>>         AND s1.data <> s2.data;
>>
>> It lists all the differences between the two hosts in settings.
>> If you have started the new host at least ones it will be filled with
>> the defaults. It however does not show settings that exist only for
>> one of the hosts.
>> <https://forum.mythtv.org>
>>

> Thanks Hika.  Your query worked nicely for me.  In case anyone else is
> interested I wrote the following bash script to use this query and compare
> settings between two hosts.

> #!/bin/bash

> HOSTNAME1="$1"
> HOSTNAME2="$2"

> # Get info from config.xml
> DBHOST=$(/usr/local/bin/getConfig.pl Database Host)
> DBNAME=$(/usr/local/bin/getConfig.pl Database DatabaseName)
> USER=$(/usr/local/bin/getConfig.pl Database UserName)
> PASSWD=$(/usr/local/bin/getConfig.pl Database Password)


> if [ "$HOSTNAME1" = "" -o "$HOSTNAME2" = "" ] ; then
>   echo "usage: $0 <hostname1> <hostname2>"
>   exit 1
> fi

> mysql -t -h $DBHOST --user=$USER --password=$PASSWD $DBNAME > /tmp/$$.tmp
> <<!!
> select s1.value,s1.data AS $HOSTNAME1, s2.data AS $HOSTNAME2 FROM settings
> AS s1 JOIN settings AS s2 ON (s1.value = s2.value) WHERE s1.hostname =
> '$HOSTNAME1' AND s2.hostname = '$HOSTNAME2' AND s1.data <> s2.data;
> quit
> !!
> cat /tmp/$$.tmp
> rm -f /tmp/$$.tmp

> You'll get output like:

> +----------------------+-----------------------+---------------------------+
> | value                | nucfrontend           | nuci3frontend     
> +----------------------+-----------------------+---------------------------+
> | AudioOutputDevice    | ALSA:default:CARD=PCH | ALSA:hdmi:CARD=HDMI,DEV=0 |
> | ChannelGroupDefault  | 1                     | -1                
> | LircSocket           | /dev/lircd            | /var/run/lirc/lircd       |
> +----------------------+-----------------------+---------------------------+

Nice! You should however mention the limitations. Only settings that
exist for both hosts and that are not equal are shown. Especially
plugin settings might only exist for one of the hosts. I do not know
if all settings originally are added in default to the table or maybe
in some cases only if they deviate from the default. So don't expect
the resulting list to be exhausting.


Tot mails,
  Hika                            mailto:hikavdh at gmail.com

"Zonder hoop kun je niet leven
Zonder leven is er geen hoop
Het eeuwige dilemma
Zeker als je hoop moet vernietigen om te kunnen overleven!"

De lerende Mens



More information about the mythtv-users mailing list