[mythtv] [PATCH]es: error reporting, fixing tv_grab_de
Ben Bucksch
linux.news at bucksch.org
Sat Apr 19 16:29:06 EDT 2003
Attached are 2 small patches for mythfilldatabase.
xmlerror: Add error reporting (to cout currently) including line and
column numbers about XML well-formedness errors in the input XMLTV file.
I terribly needed that while writing the new XMLTV data source for
Germany - mythfilldatabase failed without error because of obscure
errors in the XMLTV file and I didn't know what's up or why it's failing.
xmlidsplit: Fix the standard tv_grab_de. The standard data source for
Germany uses xmltvids with spaces (e.g. "Pro 7" as station id), and the
split "tweak" for the USA breaks that - these channels didn't end up
correctly in the database. I thus made the split conditional on the
usage of tv_grab_na. This patch is untested.
-------------- next part --------------
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.53
diff -u -r1.53 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp 19 Apr 2003 04:56:46 -0000 1.53
+++ programs/mythfilldatabase/filldata.cpp 19 Apr 2003 13:02:17 -0000
@@ -461,8 +458,14 @@
if (!f.open(IO_ReadOnly))
return;
- if (!doc.setContent(&f))
+ QString errorMsg = "unknown";
+ int errorLine = 0;
+ int errorColumn = 0;
+ if (!doc.setContent(&f, &errorMsg, &errorLine, &errorColumn))
{
+ cout << "Error in " << errorLine << ":" << errorColumn << ": "
+ << errorMsg << "\n";
+
f.close();
return;
}
@@ -575,12 +578,14 @@
QString getResponse(const QString &query, const QString &def)
{
+ /*
cout << query;
if (def != "")
{
cout << " [" << def << "] ";
}
+ */
char response[80];
cin.getline(response, 80);
-------------- next part --------------
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.53
diff -u -r1.53 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp 19 Apr 2003 04:56:46 -0000 1.53
+++ programs/mythfilldatabase/filldata.cpp 19 Apr 2003 13:25:21 -0000
@@ -30,6 +30,7 @@
bool quiet = false;
bool no_delete = false;
bool isgist = false;
+bool isNorthAmerica = false; // XXX global vars are ugly
MythContext *gContext;
@@ -176,7 +177,7 @@
QString xmltvid = element.attribute("id", "");
QStringList split = QStringList::split(" ", xmltvid);
- if (!isgist)
+ if (isNorthAmerica)
{
chaninfo->xmltvid = split[0];
chaninfo->chanstr = split[0];
@@ -187,8 +188,8 @@
}
else
{
- chaninfo->callsign = "";
- chaninfo->chanstr = "";
+ chaninfo->callsign = ""; // use xmltvid?
+ chaninfo->chanstr = ""; // use xmltvid?
chaninfo->xmltvid = xmltvid;
}
@@ -362,10 +363,14 @@
pginfo->endts = et;
- text = element.attribute("channel", "");
- split = QStringList::split(" ", text);
-
- pginfo->channel = split[0];
+ if (isNorthAmerica)
+ {
+ text = element.attribute("channel", "");
+ split = QStringList::split(" ", text);
+ pginfo->channel = split[0];
+ }
+ else
+ pginfo->channel = element.attribute("channel", "");
pginfo->start = fromXMLTVDate(pginfo->startts);
pginfo->end = fromXMLTVDate(pginfo->endts);
@@ -1106,6 +1119,8 @@
command.sprintf("nice -19 %s --days 7 --config-file %s --output %s",
xmltv_grabber.ascii(), configfile.ascii(),
filename.ascii());
+ else if (xmltv_grabber == "tv_grab_na")
+ isNorthAmerica = true;
else if (xmltv_grabber == "tv_grab_nz")
command.sprintf("nice -19 %s -n 1 -f %d -o %s",
xmltv_grabber.ascii(), offset,
More information about the mythtv-dev
mailing list