[mythtv] [PATCH] --dd-custom-get parameter for mythfilldatabase
Tom McKearney
tommck at gmail.com
Fri Feb 18 16:06:49 UTC 2005
This is attempt #2 to submit this. Hopefully the frenzy of 0.17's
release is over.
The --dd-file option allows one to include files downloaded through
some external device, but it does not allow for a way to get the SOAP
envelope data (which depends on the database) to send to the
DataDirect site in order to get the data.
So, I added this option that allows you to pass in the name of an
external program/script to download the data during mythfilldatabase's
execution. (the script should spit the XML back out to stdout)
Tom
P.S. Here's my diff:
Index: libs/libmythtv/datadirect.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/datadirect.h,v
retrieving revision 1.4
diff -u -r1.4 datadirect.h
--- libs/libmythtv/datadirect.h 28 Jan 2005 07:33:46 -0000 1.4
+++ libs/libmythtv/datadirect.h 18 Feb 2005 15:59:32 -0000
@@ -255,7 +255,8 @@
void updateProgramViewTable(int sourceid);
bool grabLineupsOnly();
- bool grabData(bool plineupsonly, QDateTime pstartdate, QDateTime penddate);
+ bool grabData(bool plineupsonly, QDateTime pstartdate,
+ QDateTime penddate, QString customget = "");
bool grabAllData(void);
void parseLineups();
@@ -280,7 +281,8 @@
QString inputfilename;
FILE *getInputFile(bool plineupsOnly, QDateTime pstartDate,
- QDateTime pendDate, QString &err_txt, QString &tmpfilename);
+ QDateTime pendDate, QString &err_txt, QString &tmpfilename,
+ QString& customGet);
void createATempTable(const QString &ptablename,
const QString &ptablestruct);
Index: libs/libmythtv/datadirect.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/datadirect.cpp,v
retrieving revision 1.14
diff -u -r1.14 datadirect.cpp
--- libs/libmythtv/datadirect.cpp 28 Jan 2005 07:33:46 -0000 1.14
+++ libs/libmythtv/datadirect.cpp 18 Feb 2005 15:59:45 -0000
@@ -440,7 +440,8 @@
}
FILE *DataDirectProcessor::getInputFile(bool plineupsOnly, QDateTime
pstartDate,
- QDateTime pendDate, QString &err_txt, QString &tmpfilename)
+ QDateTime pendDate, QString &err_txt, QString &tmpfilename,
+ QString& customget)
{
FILE *ret = NULL;
if (inputfilename.isNull())
@@ -497,13 +498,26 @@
postfile.close();
- QString command = QString("wget --http-user='%1' --http-passwd='%2' "
+ QString command;
+ if (customget.length() > 0)
+ {
+ command = QString("%1 %2 %3 %4 %5")
+ .arg(customget)
+ .arg(getUserID())
+ .arg(getPassword())
+ .arg(tmpfilename).arg(ddurl);
+ }
+ else
+ {
+
+ command = QString("wget --http-user='%1' --http-passwd='%2' "
"--post-file='%3'
--header='Accept-Encoding:gzip'"
" %4 --output-document=- | gzip -df")
.arg(getUserID())
.arg(getPassword())
.arg(tmpfilename)
.arg(ddurl);
+ }
err_txt = command;
@@ -518,13 +532,13 @@
return ret;
}
-bool DataDirectProcessor::grabData(bool plineupsOnly, QDateTime pstartDate,
- QDateTime pendDate)
+bool DataDirectProcessor::grabData(bool plineupsOnly, QDateTime pstartDate,
+ QDateTime pendDate, QString customget)
{
QString ferror;
QString tempfile;
FILE *fp = getInputFile(plineupsOnly, pstartDate, pendDate, ferror,
- tempfile);
+ tempfile, customget);
if (fp == NULL)
{
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.156
diff -u -r1.156 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp 9 Feb 2005 21:35:13 -0000 1.156
+++ programs/mythfilldatabase/filldata.cpp 18 Feb 2005 16:00:33 -0000
@@ -56,6 +56,7 @@
QString lastdduserid;
DataDirectProcessor ddprocessor;
QString graboptions = "";
+QString dd_custom_get = "";
class ChanInfo
{
@@ -988,7 +989,7 @@
if (!quiet)
cout << "From : " << fromdatetime.toString()
<< " To : " << todatetime.toString() << " (UTC)\n";
- ddprocessor.grabData(false, fromdatetime, todatetime);
+ ddprocessor.grabData(false, fromdatetime, todatetime,
dd_custom_get);
}
dddataretrieved = true;
@@ -3367,6 +3368,16 @@
}
}
}
+ else if (!strcmp(a.argv()[argpos], "--dd-custom-get"))
+ {
+ if (((argpos + 1) >= a.argc()) ||
+ !strncmp(a.argv()[argpos + 1], "--", 2))
+ {
+ cerr << "Missing parameter for --dd-custom-get option" << endl;
+ return -1;
+ }
+ dd_custom_get = QString(a.argv()[++argpos]);
+ }
else if (!strcmp(a.argv()[argpos], "-h") ||
!strcmp(a.argv()[argpos], "--help"))
{
@@ -3443,6 +3454,9 @@
cout << "--dd-grab-all\n";
cout << " The DataDirect grabber will grab all available data\n";
#endif
+ cout << "--dd-custom-get <filename>\n";
+ cout << " Use a custom get script whose arguments are:\n";
+ cout << " <userId> <password> <postDataFile>
<DataDirect URL>\n";
cout << "--help\n";
cout << " This text\n";
cout << "\n";
More information about the mythtv-dev
mailing list