From 35794fe40b12b1888750cdf99396a27288cd74b0 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 21 Apr 2012 21:29:53 -0500
Subject: mythtv-0.25: update myth_settings patch to include hostname override

---
 abs/core/mythtv/stable-0.25/mythtv/PKGBUILD        |  2 +-
 .../mythtv/stable-0.25/mythtv/myth_settings.patch  | 53 +++++++++++++++++-----
 2 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD b/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD
index dcecff0..305b5f6 100644
--- a/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD
+++ b/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD
@@ -104,7 +104,7 @@ package() {
 
 md5sums=('7ef6de58240e7aad389a0b13d91b1cf6'
          '2babd4b8e146a7538d18dcd55695b0be'
-         '58ab374d2c51b577359ae77385ab3edf'
+         '55c079404303ec4edeb1a8af1cf16597'
          'f735805a80b0d1180dee01f9df1b7004'
          'f407d6af23e74a49540755420f84fa58'
          '5469d9921b726db750b991c87d226158')
diff --git a/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch b/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch
index abdabfe..5fbcddf 100644
--- a/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch
+++ b/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch
@@ -1106,7 +1106,7 @@ index 79abe56..fe3c91c 100644
      void SetHaveSchema(bool schema);
      bool HaveSchema(void) const;
 diff --git a/mythtv/programs/mythutil/commandlineparser.cpp b/mythtv/programs/mythutil/commandlineparser.cpp
-index 7f00e50..03f1792 100644
+index 7f00e50..6fb2fc2 100644
 --- a/mythtv/programs/mythutil/commandlineparser.cpp
 +++ b/mythtv/programs/mythutil/commandlineparser.cpp
 @@ -114,6 +114,37 @@ void MythUtilCommandLineParser::LoadArguments(void)
@@ -1147,7 +1147,7 @@ index 7f00e50..03f1792 100644
          );
  
      // mpegutils.cpp
-@@ -136,6 +167,55 @@ void MythUtilCommandLineParser::LoadArguments(void)
+@@ -136,6 +167,59 @@ void MythUtilCommandLineParser::LoadArguments(void)
      add("--bcastaddr", "bcastaddr", "127.0.0.1", "(optional) IP address to send to", "")
          ->SetChildOf("message");
  
@@ -1163,7 +1163,8 @@ index 7f00e50..03f1792 100644
 +        ->SetChildOf("restoresettings")
 +        ->SetChildOf("copysettings")
 +        ->SetChildOf("deletesettings")
-+        ->SetChildOf("exportsettings");
++        ->SetChildOf("exportsettings")
++        ->SetChildOf("importsettings");
 +
 +    add("--host_1", "host_1", "", "First host in compare list", "")
 +        ->SetRequiredChildOf("diffsettings");
@@ -1196,6 +1197,9 @@ index 7f00e50..03f1792 100644
 +    add("--distro-default", "distro-default", false, "Export settings for"
 +        "import into the default table", "")
 +        ->SetChildOf("exportsettings");
++    add("--generic", "generic", false, "export settings without saving "
++        "the hostname", "")
++        ->SetChildOf("exportsettings");
 +
 +
 +
@@ -1259,10 +1263,10 @@ index 774528f..5be3ec7 100644
  mingw: LIBS += -lwinmm -lws2_32
 diff --git a/mythtv/programs/mythutil/settingsutils.cpp b/mythtv/programs/mythutil/settingsutils.cpp
 new file mode 100644
-index 0000000..ed3c9a3
+index 0000000..ff7e509
 --- /dev/null
 +++ b/mythtv/programs/mythutil/settingsutils.cpp
-@@ -0,0 +1,541 @@
+@@ -0,0 +1,566 @@
 +// C++ includes
 +#include <iostream>
 +
@@ -1587,12 +1591,19 @@ index 0000000..ed3c9a3
 +
 +static int ImportSettings(const MythUtilCommandLineParser &cmdline)
 +{
++
 +    if (cmdline.toString("infile").isEmpty())
 +    {
 +        LOG(VB_STDIO|VB_FLUSH, LOG_ERR, "Missing --infile option\n");
 +        return GENERIC_EXIT_INVALID_CMDLINE;
 +    }
-+
++    QString import_hostname;
++    bool change_name = FALSE;
++    if (cmdline.toBool("hostname"))
++    {
++        change_name = TRUE;
++        import_hostname = cmdline.toString("hostname");
++    }
 +    QString import_filename = cmdline.toString("infile");
 +    QFile myFile(import_filename);
 +
@@ -1635,7 +1646,10 @@ index 0000000..ed3c9a3
 +            record_element = subn.toElement();
 +            if ( record_element.nodeName() == "table" )
 +                    continue;
-+            value_pair_map[record_element.nodeName()] = record_element.text();
++            if ( change_name && record_element.nodeName() == "hostname" )
++                value_pair_map[record_element.nodeName()] = import_hostname;
++            else
++                value_pair_map[record_element.nodeName()] = record_element.text();
 +        }
 +            //perform insert
 +            gCoreContext->import_settings(value_pair_map,table_name);
@@ -1652,6 +1666,7 @@ index 0000000..ed3c9a3
 +    QStringList table_list;
 +    QString tablestring;
 +    bool distro_default =  FALSE;
++    bool generic = FALSE;
 +    QDomDocument doc("mythutils_exported_settings");
 +
 +    if (cmdline.toBool("groupname"))
@@ -1667,6 +1682,9 @@ index 0000000..ed3c9a3
 +    if (cmdline.toBool("distro-default"))
 +        distro_default = TRUE;
 +
++    if (cmdline.toBool("generic"))
++        generic = TRUE;
++
 +    if (cmdline.toBool("table_list"))
 +    {
 +        tablestring = QString(cmdline.toString("table_list"));
@@ -1720,12 +1738,23 @@ index 0000000..ed3c9a3
 +                    else
 +                        t = doc.createTextNode(y.value());
 +                }
-+                else
-+                {
-+                    t = doc.createTextNode(y.value());
-+                }
-+                tag.appendChild(t);
 +
++                else if ( generic == TRUE )
++                {   // If exporting generic then change hostname
++                    if ( y.key() == "hostname" )
++                    {   //check for global values here, empty value means global
++                        if ( y.value().isEmpty() )
++                            t = doc.createTextNode(y.value());
++                        else
++                            t = doc.createTextNode("REPLACE_ME");
++                    }
++                    else
++                       t = doc.createTextNode(y.value());
++               }
++               else
++                   t = doc.createTextNode(y.value());
++
++               tag.appendChild(t);
 +                //create record counts
 +                if ( y.key() == "table" )
 +                {
-- 
cgit v0.12