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

R. G. Newbury newbury at mandamus.org
Fri Oct 30 21:21:42 UTC 2015


On 10/30/2015 02:21 PM, Mike Rice wrote:
> On Mon, Oct 26, 2015 at 1:46 PM, Hika van den Hoven <hikavdh at gmail.com
> <mailto: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       |
> +----------------------+-----------------------+---------------------------+
>

This is nice. And should be posted into the wiki!

Thanks Mike.




More information about the mythtv-users mailing list