[mythtv] [PATCH] mythfilldatabase errors
Ben Bucksch
linux.news at bucksch.org
Tue Apr 22 21:39:55 EDT 2003
Isaac Richards wrote:
>You've either got duplicate programs in the data (in which case the error message is innocuous),
>
I guess I do, given the tons of "removing conflicting program" messages.
I didn't know, if it's a problem or not, it sounded bad :). However,
it's annoying, because it's 10 lines each and that maybe 1000 times.
That either totally spams the console (possibly scolling away more
important errors) or results in a very big cron mail.
>or you've got multiple channels with the same chanid.
>
I don't think I do.
>The role can only be certain values to be a valid xmltv file
>
Yes, I didn't realize that the "role" is that tag name, that's the
confusion I spoke of.
> Ben Bucksch wrote:
>> BTW: Maybe change the role column to an int to speed things up
>> (1=actor, 2=presenter) and change its name to "type" or something
>> else - I'd think that the character name is in field "role".
>
A patch to implement that is attached.
DB changes:
ALTER TABLE credits ADD COLUMN type TINYINT NOT NULL default '0';
alter table credits drop primary key; (was necessary to remove column role?)
ALTER TABLE credits DROP COLUMN role;
-------------- next part --------------
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.56
diff -u -r1.56 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp 22 Apr 2003 16:06:53 -0000 1.56
+++ programs/mythfilldatabase/filldata.cpp 22 Apr 2003 18:37:27 -0000
@@ -19,17 +19,46 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <map>
#include "libmyth/mythcontext.h"
using namespace std;
+map<QString, short> creditstype; // logically const
+
+void fillmaps()
+{
+ // to speed up lookups of the credits table, use ints, not strings, in DB:
+ creditstype["director"] = 1;
+ creditstype["actor"] = 2;
+ creditstype["writer"] = 3;
+ creditstype["adapter"] = 4;
+ creditstype["producer"] = 5;
+ creditstype["presenter"] = 6;
+ creditstype["commentator"] = 7;
+ creditstype["guest"] = 8;
+
+ /* The corresponding lookup tabel would be:
+ map<short, QString> creditstype;
+ creditstype[1] = "director";
+ creditstype[2] = "actor";
+ creditstype[3] = "writer";
+ creditstype[4] = "adapter";
+ creditstype[5] = "producer";
+ creditstype[6] = "presenter";
+ creditstype[7] = "commentator";
+ creditstype[8] = "guest";
+ */
+}
+
bool interactive = false;
bool non_us_updating = false;
bool from_file = false;
bool quiet = false;
bool no_delete = false;
bool isgist = false;
+bool isNorthAmerica = false; // XXX global vars are ugly
MythContext *gContext;
@@ -61,7 +90,7 @@
struct ProgCredit
{
- QString role;
+ short type;
QString name;
};
@@ -307,7 +336,7 @@
if (!info.isNull())
{
ProgCredit credit;
- credit.role = info.tagName();
+ credit.type = creditstype[info.tagName()];
credit.name = getFirstText(info);
pginfo->credits.append(credit);
}
@@ -1069,11 +1102,11 @@
}
querystr.sprintf("INSERT INTO credits (chanid,starttime,"
- "role,person) VALUES "
- "(%d, \"%s\", \"%s\", %d);",
+ "type,person) VALUES "
+ "(%d, \"%s\", %d, %d);",
chanid,
(*i).start.toString("yyyyMMddhhmmss").ascii(),
- (*k).role.ascii(),
+ (*k).type,
personid);
if (!query.exec(querystr.utf8().data()))
@@ -1475,6 +1510,8 @@
bool from_xawfile = false;
int fromxawfile_id = 1;
QString fromxawfile_name;
+
+ fillmaps();
while (argpos < a.argc())
{
More information about the mythtv-dev
mailing list