From dfd3ed704cf530934b9551fd0f07c906cd41cb81 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sat, 29 Sep 2012 15:06:54 -0500 Subject: mythtv: updated mythutil.patch. This one add restore from default and also includes jumpoint table --- abs/core/mythtv/stable-0.25/mythtv/PKGBUILD | 8 +- .../stable-0.25/mythtv/myth_settings-2.patch | 38 ---- .../mythtv/stable-0.25/mythtv/myth_settings.patch | 234 +++++++++++++++++---- 3 files changed, 193 insertions(+), 87 deletions(-) delete mode 100755 abs/core/mythtv/stable-0.25/mythtv/myth_settings-2.patch diff --git a/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD b/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD index c5100fa..c173e20 100644 --- a/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD +++ b/abs/core/mythtv/stable-0.25/mythtv/PKGBUILD @@ -6,7 +6,7 @@ pkgname=mythtv pkgver=0.25 -pkgrel=13 +pkgrel=18 commit_hash=`cat ../git_src/git_hash` pkgdesc="A Homebrew PVR project $commit_hash" arch=('i686' 'x86_64') @@ -62,7 +62,8 @@ groups=('pvr') #options=(!strip) #MAKEFLAGS="-j6" install='mythtv.install' -patchs=('myth_settings.patch' 'myth_settings-2.patch') +#patchs=('myth_settings.patch' 'myth_settings-2.patch') +patchs=('myth_settings.patch' ) optdepends=('xmltv: to download tv listings') replaces=('mythvideo' 'myththemes') conflicts=('mythvideo' 'myththemes') @@ -143,8 +144,7 @@ package() { md5sums=('7ef6de58240e7aad389a0b13d91b1cf6' '2babd4b8e146a7538d18dcd55695b0be' - 'c4db7784c5107ae846fd795a4dabe0bc' - '08634edc00f738b8732bfa7f574e22fd' + '322f48528b350f0e6aebfff6eab4c4ee' 'f735805a80b0d1180dee01f9df1b7004' 'f407d6af23e74a49540755420f84fa58' '5469d9921b726db750b991c87d226158') diff --git a/abs/core/mythtv/stable-0.25/mythtv/myth_settings-2.patch b/abs/core/mythtv/stable-0.25/mythtv/myth_settings-2.patch deleted file mode 100755 index 4e83473..0000000 --- a/abs/core/mythtv/stable-0.25/mythtv/myth_settings-2.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/mythtv/programs/mythutil/settingsutils.cpp b/mythtv/programs/mythutil/settingsutils.cpp -index ff7e509..d229f27 100644 ---- a/mythtv/programs/mythutil/settingsutils.cpp -+++ b/mythtv/programs/mythutil/settingsutils.cpp -@@ -382,6 +382,17 @@ static int ImportSettings(const MythUtilCommandLineParser &cmdline) - else - value_pair_map[record_element.nodeName()] = record_element.text(); - } -+ if (import_filename.endsWith("syssettings.xml")) -+ { -+ if ( value_pair_map["value"] == "BackendServerIP") -+ { -+ out_string = "sysettings, ignoring backendserver ip record"; -+ cout << out_string.toLocal8Bit().constData() << endl; -+ } -+ else -+ gCoreContext->import_settings(value_pair_map,table_name); -+ } -+ else - //perform insert - gCoreContext->import_settings(value_pair_map,table_name); - } -@@ -454,7 +465,6 @@ static int ExportSettings(const MythUtilCommandLineParser &cmdline) - QDomElement tag = doc.createElement(y.key()); - record.appendChild(tag); - QDomText t; -- - if ( distro_default == TRUE ) - { // If exporting distro_default then change hostname + table - if ( y.key() == "hostname" ) -@@ -500,6 +510,7 @@ static int ExportSettings(const MythUtilCommandLineParser &cmdline) - } - } - QFile file( export_filename ); -+ - if( !file.open(QIODevice::WriteOnly) ) - return -1; - 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 ebc6264..a96051b 100644 --- a/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch +++ b/abs/core/mythtv/stable-0.25/mythtv/myth_settings.patch @@ -1,5 +1,13 @@ +commit 9b4205fa320c06afde8c6d866b854cb12d3ec99c +Author: root +Date: Fri Sep 28 14:25:06 2012 -0500 + + new patch + + Signed-off-by: root + diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp -index ad58f59..809d662 100644 +index 84cb01a..6e3c54a 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -1260,6 +1260,90 @@ void MythCoreContext::ResetLanguage(void) @@ -80,11 +88,11 @@ index ad58f59..809d662 100644 +QMap > MythCoreContext::export_settings( + QString src_hostname, + QString saved_settingsgroupname, -+ QStringList table_list) ++ QStringList table_list, bool skip_host ) +{ + return d->m_database->export_settings(src_hostname, + saved_settingsgroupname, -+ table_list); ++ table_list , skip_host ); +} + +//END JM ADDED @@ -94,10 +102,10 @@ index ad58f59..809d662 100644 { if (!d->m_locale) diff --git a/mythtv/libs/libmythbase/mythcorecontext.h b/mythtv/libs/libmythbase/mythcorecontext.h -index 0917313..db3bbb9 100644 +index 0917313..3f6d5f8 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.h +++ b/mythtv/libs/libmythbase/mythcorecontext.h -@@ -168,6 +168,39 @@ class MBASE_PUBLIC MythCoreContext : public MythObservable, public MythSocketCBs +@@ -168,6 +168,40 @@ class MBASE_PUBLIC MythCoreContext : public MythObservable, public MythSocketCBs QString GetLanguageAndVariant(void); void ResetLanguage(void); @@ -131,14 +139,15 @@ index 0917313..db3bbb9 100644 + QMap > export_settings( + QString src_hostname, + QString saved_settingsgroupname, -+ QStringList table_list); ++ QStringList table_list, ++ bool skip_host = FALSE ); + //END JM ADDED + private: MythCoreContextPrivate *d; diff --git a/mythtv/libs/libmythbase/mythdb.cpp b/mythtv/libs/libmythbase/mythdb.cpp -index ea30783..730fc3e 100644 +index ea30783..e4c1781 100644 --- a/mythtv/libs/libmythbase/mythdb.cpp +++ b/mythtv/libs/libmythbase/mythdb.cpp @@ -774,7 +774,7 @@ void MythDB::OverrideSettingForSession( @@ -150,7 +159,7 @@ index ea30783..730fc3e 100644 QString("ERROR: Refusing to allow override for '%1'.").arg(key)); return; } -@@ -1055,6 +1055,901 @@ void MythDB::WriteDelayedSettings(void) +@@ -1055,6 +1055,1015 @@ void MythDB::WriteDelayedSettings(void) } } @@ -168,6 +177,7 @@ index ea30783..730fc3e 100644 + QString hostname_clause; + table_list.append("settings"); + table_list.append("keybindings"); ++ table_list.append("jumppoints"); + if ( src_hostname == "GLOBAL" ) + hostname_clause = "hostname IS NULL"; + else @@ -228,6 +238,7 @@ index ea30783..730fc3e 100644 + + table_list.append("settings"); + table_list.append("keybindings"); ++ table_list.append("jumppoints"); + QString hostname_clause; + if ( delete_hostname == "GLOBAL" ) + hostname_clause = "hostname IS NULL"; @@ -490,6 +501,7 @@ index ea30783..730fc3e 100644 + { + table_list.append("settings"); + table_list.append("keybindings"); ++ table_list.append("jumppoints"); + } + + for ( it = table_list.begin(); it != table_list.end(); ++it ) @@ -587,7 +599,14 @@ index ea30783..730fc3e 100644 + else + hostname_clause ="hostname = :HOSTNAME"; + -+ if ( settings_check ( dest_hostname , saved_settingsgroupname ) ) ++ bool table_check; ++ if ( saved_settingsgroupname == "distro_default" ) ++ table_check = settings_check ( "distro_default" , saved_settingsgroupname ); ++ else ++ table_check = settings_check ( dest_hostname , saved_settingsgroupname ); ++ ++ ++ if ( table_check == TRUE ) + { + MSqlQuery query(MSqlQuery::InitCon()); + QStringList::Iterator it; @@ -596,6 +615,7 @@ index ea30783..730fc3e 100644 + { + table_list.append("settings"); + table_list.append("keybindings"); ++ table_list.append("jumppoints"); + } + + for ( it = table_list.begin(); it != table_list.end(); ++it ) @@ -606,22 +626,54 @@ index ea30783..730fc3e 100644 + saved_settingsgroupname); + + QString temptable="temp_table_" + src_tablename; -+ ++ if ( ! does_table_exist(src_tablename)) ++ { ++ LOG(VB_GENERAL, LOG_NOTICE, QString("table does not exist: %1") ++ .arg(src_tablename)); ++ continue; ++ } + // create temp table for merging settings + create_temp_table(temptable, current_table ); + + //could copy in current settings here to account for new stuff + ++ ++ + // copy in stored settings -+ QString query_string = QString("REPLACE INTO %1 " -+ "(SELECT * from %2 WHERE %3)") -+ .arg(temptable) -+ .arg(src_tablename) -+ .arg(hostname_clause); ++ QString query_string; ++ if ( saved_settingsgroupname == "distro_default" ) ++ { //special case for restoring default settings ++ query_string = QString("REPLACE INTO %1 " ++ "(SELECT * from %2 WHERE %3)") ++ .arg(temptable) ++ .arg(src_tablename) ++ .arg(hostname_clause); + -+ query.prepare(query_string); -+ query.bindValue(":HOSTNAME",dest_hostname ); -+ query.exec(); ++ query.prepare(query_string); ++ query.bindValue(":HOSTNAME", "distro_default" ); ++ query.exec(); ++ ++ // update hostname in temp table from distro_default ++ query_string = QString("UPDATE %1 set hostname = :HOSTNAME") ++ .arg(temptable); ++ ++ query.prepare(query_string); ++ query.bindValue(":HOSTNAME" , dest_hostname ); ++ query.exec(); ++ ++ } ++ else ++ { //normal use case ++ query_string = QString("REPLACE INTO %1 " ++ "(SELECT * from %2 WHERE %3)") ++ .arg(temptable) ++ .arg(src_tablename) ++ .arg(hostname_clause); ++ ++ query.prepare(query_string); ++ query.bindValue(":HOSTNAME",dest_hostname ); ++ query.exec(); ++ } + + //Remove current settings. + //Need to remove because the old table allows for duplicates @@ -875,13 +927,69 @@ index ea30783..730fc3e 100644 + } + } + } ++ //JUMP POINTS ++ else if (table.startsWith("jumppoints")) ++ { ++ if ( table != "jumppoints" ) ++ create_new_table(table,"jumppoints"); ++ QString hostname = vp_map.value("hostname"); ++ QString description = vp_map.value("description"); ++ QString destination = vp_map.value("destination"); ++ QString keylist = vp_map.value("keylist"); ++ ++ QString query_string=QString("SELECT destination, keylist " ++ "FROM %1 " ++ "WHERE hostname = :HOSTNAME AND " ++ "destination = :DESTINATION " ++ "AND keylist = :KEYLIST ").arg(table); ++ query.prepare(query_string); ++ query.bindValue(":HOSTNAME", hostname); ++ query.bindValue(":DESTINATION", destination); ++ query.bindValue(":KEYLIST", keylist); ++ ++ if (query.exec() && query.isActive()) ++ { ++ MSqlQuery sub_query(MSqlQuery::InitCon()); ++ if ( query.size() > 0 ) ++ { ++ query_string = QString("UPDATE " ++ " %1 " ++ "set keylist = :KEYLIST " ++ "WHERE hostname = :HOSTNAME AND " ++ "destination = :DESTINATION ").arg(table); ++ ++ sub_query.prepare(query_string); ++ sub_query.bindValue(":HOSTNAME", hostname); ++ sub_query.bindValue(":KEYLIST", keylist); ++ sub_query.bindValue(":DESTINATION", destination); ++ sub_query.exec(); ++ } ++ else ++ { ++ query_string = QString("INSERT INTO " ++ " %1 " ++ " (description , destination, keylist , hostname) " ++ " VALUES( " ++ " :DESCRIPTION ," ++ " :DESTINATION , " ++ " :KEYLIST , " ++ " :HOSTNAME)").arg(table) ; + ++ sub_query.prepare(query_string); ++ sub_query.bindValue(":HOSTNAME", hostname); ++ sub_query.bindValue(":KEYLIST", keylist); ++ sub_query.bindValue(":DESTINATION", destination); ++ sub_query.bindValue(":DESCRIPTION", description); ++ sub_query.exec(); ++ } ++ } ++ } +}; //end import_settings + +QMap > + MythDB::export_settings(QString src_hostname, + QString saved_settingsgroupname, -+ QStringList table_list) ++ QStringList table_list, bool skip_host ) +{ + QMap > result_set; + QStringList::Iterator it; @@ -892,6 +1000,7 @@ index ea30783..730fc3e 100644 + { + table_list.append("settings"); + table_list.append("keybindings"); ++ table_list.append("jumppoints"); + } + + MSqlQuery query(MSqlQuery::InitCon()); @@ -909,10 +1018,11 @@ index ea30783..730fc3e 100644 + saved_settingsgroupname); + + QString hostname_clause; -+ if ( src_hostname == "GLOBAL" ) -+ hostname_clause = "hostname IS NULL"; -+ else -+ hostname_clause ="hostname = :HOSTNAME"; ++ if ( src_hostname == "GLOBAL" ) ++ hostname_clause = "hostname IS NULL"; ++ else ++ hostname_clause ="hostname = :HOSTNAME"; ++ + // find field names + query_string = QString("SHOW COLUMNS from %1").arg(table_name); + query.prepare(query_string); @@ -929,12 +1039,25 @@ index ea30783..730fc3e 100644 + field_query += tempItem; + } + } ++ // when working with settings table skip HOST if skip_host is true ++ if ( current_table == "settings" && skip_host == TRUE ) ++ { ++ QString skip_host_clause; ++ skip_host_clause = " VALUE not like 'HOST%' AND DATA not like 'HardwareProfile%UUID'" ; ++ query_string = QString("SELECT %1 FROM %2 WHERE %3 AND %4") ++ .arg(field_query) ++ .arg(table_name) ++ .arg(hostname_clause) ++ .arg(skip_host_clause); + -+ query_string = QString("SELECT %1 FROM %2 WHERE %3") -+ .arg(field_query) -+ .arg(table_name) -+ .arg(hostname_clause); -+ ++ } ++ else ++ { ++ query_string = QString("SELECT %1 FROM %2 WHERE %3") ++ .arg(field_query) ++ .arg(table_name) ++ .arg(hostname_clause); ++ } + query.prepare(query_string); + query.bindValue(":HOSTNAME" , src_hostname); + @@ -986,7 +1109,7 @@ index ea30783..730fc3e 100644 +void MythDB::drop_temp_table (QString table_name) +{ + MSqlQuery query(MSqlQuery::InitCon()); -+ if (table_name == "settings" | table_name == "keybindings") ++ if (table_name == "settings" | table_name == "keybindings" | table_name == "jumppoints") + return; + QString query_string = QString("DROP TABLE %1").arg(table_name); + query.prepare(query_string); @@ -1053,10 +1176,10 @@ index ea30783..730fc3e 100644 * \brief Set a flag indicating we have successfully connected to the database */ diff --git a/mythtv/libs/libmythbase/mythdb.h b/mythtv/libs/libmythbase/mythdb.h -index 79abe56..fe3c91c 100644 +index 79abe56..fd6044e 100644 --- a/mythtv/libs/libmythbase/mythdb.h +++ b/mythtv/libs/libmythbase/mythdb.h -@@ -75,6 +75,48 @@ class MBASE_PUBLIC MythDB +@@ -75,6 +75,49 @@ class MBASE_PUBLIC MythDB void WriteDelayedSettings(void); @@ -1090,7 +1213,8 @@ index 79abe56..fe3c91c 100644 + QMap > export_settings( + QString src_hostname, + QString saved_settingsgroupname, -+ QStringList table_list); ++ QStringList table_list, ++ bool skip_host = FALSE); + + void create_new_table (QString create_table_name,QString like_name); + void drop_temp_table (QString table_name); @@ -1106,10 +1230,10 @@ 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..6fb2fc2 100644 +index f4a6035..fdeeb8e 100644 --- a/mythtv/programs/mythutil/commandlineparser.cpp +++ b/mythtv/programs/mythutil/commandlineparser.cpp -@@ -114,6 +114,37 @@ void MythUtilCommandLineParser::LoadArguments(void) +@@ -118,6 +118,37 @@ void MythUtilCommandLineParser::LoadArguments(void) << add("--print-template", "printtemplate", false, "Print the template to be sent to the frontend", "") ->SetGroup("Messaging") @@ -1147,7 +1271,7 @@ index 7f00e50..6fb2fc2 100644 ); // mpegutils.cpp -@@ -136,6 +167,59 @@ void MythUtilCommandLineParser::LoadArguments(void) +@@ -140,6 +171,59 @@ void MythUtilCommandLineParser::LoadArguments(void) add("--bcastaddr", "bcastaddr", "127.0.0.1", "(optional) IP address to send to", "") ->SetChildOf("message"); @@ -1229,10 +1353,10 @@ index 418ea01..bd4a1f4 100644 bool cmdFound = false; int cmdResult = GENERIC_EXIT_OK; diff --git a/mythtv/programs/mythutil/mythutil.pro b/mythtv/programs/mythutil/mythutil.pro -index 774528f..5be3ec7 100644 +index 066e618..87d7952 100644 --- a/mythtv/programs/mythutil/mythutil.pro +++ b/mythtv/programs/mythutil/mythutil.pro -@@ -10,7 +11,7 @@ TARGET = mythutil +@@ -10,7 +10,7 @@ TARGET = mythutil target.path = $${PREFIX}/bin INSTALLS = target @@ -1241,7 +1365,7 @@ index 774528f..5be3ec7 100644 INCLUDEPATH += ../../libs/libmythbase QMAKE_CLEAN += $(TARGET) -@@ -19,8 +20,10 @@ QMAKE_CLEAN += $(TARGET) +@@ -19,8 +19,10 @@ QMAKE_CLEAN += $(TARGET) HEADERS += mythutil.h commandlineparser.h HEADERS += backendutils.h fileutils.h jobutils.h markuputils.h HEADERS += messageutils.h mpegutils.h @@ -1255,10 +1379,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..ff7e509 +index 0000000..8fc7b0e --- /dev/null +++ b/mythtv/programs/mythutil/settingsutils.cpp -@@ -0,0 +1,566 @@ +@@ -0,0 +1,586 @@ +// C++ includes +#include + @@ -1643,6 +1767,17 @@ index 0000000..ff7e509 + else + value_pair_map[record_element.nodeName()] = record_element.text(); + } ++ if (import_filename.endsWith("syssettings.xml")) ++ { ++ if ( value_pair_map["value"] == "BackendServerIP") ++ { ++ out_string = "sysettings, ignoring backendserver ip record"; ++ cout << out_string.toLocal8Bit().constData() << endl; ++ } ++ else ++ gCoreContext->import_settings(value_pair_map,table_name); ++ } ++ else + //perform insert + gCoreContext->import_settings(value_pair_map,table_name); + } @@ -1659,6 +1794,10 @@ index 0000000..ff7e509 + QString tablestring; + bool distro_default = FALSE; + bool generic = FALSE; ++ bool skip_host = FALSE; ++ ++ ++ + QDomDocument doc("mythutils_exported_settings"); + + if (cmdline.toBool("groupname")) @@ -1672,18 +1811,22 @@ index 0000000..ff7e509 + src_hostname = gCoreContext->GetHostName(); + + if (cmdline.toBool("distro-default")) ++ { + distro_default = TRUE; -+ ++ skip_host = TRUE; ++ } + if (cmdline.toBool("generic")) ++ { + generic = TRUE; -+ ++ //skip_host = TRUE; ++ } + if (cmdline.toBool("table_list")) + { + tablestring = QString(cmdline.toString("table_list")); + table_list = tablestring.split(",", QString::SkipEmptyParts); + } + else -+ table_list << "settings" <<"keybindings" ; ++ table_list << "settings" <<"keybindings" <<"jumppoints" ; + + if (cmdline.toString("outfile").isEmpty()) + { @@ -1693,7 +1836,8 @@ index 0000000..ff7e509 + + QString export_filename = cmdline.toString("outfile"); + -+ records = gCoreContext->export_settings(src_hostname,groupname,table_list); ++ records = gCoreContext->export_settings(src_hostname,groupname, ++ table_list, skip_host); + + QDomElement exported_xml = doc.createElement("exported_xml"); + doc.appendChild(exported_xml); @@ -1715,7 +1859,6 @@ index 0000000..ff7e509 + QDomElement tag = doc.createElement(y.key()); + record.appendChild(tag); + QDomText t; -+ + if ( distro_default == TRUE ) + { // If exporting distro_default then change hostname + table + if ( y.key() == "hostname" ) @@ -1761,6 +1904,7 @@ index 0000000..ff7e509 + } + } + QFile file( export_filename ); ++ + if( !file.open(QIODevice::WriteOnly) ) + return -1; + -- cgit v0.12