--- programs/mythfilldatabase/filldata.cpp.nostatic	2006-09-25 23:08:37.000000000 -0400
+++ programs/mythfilldatabase/filldata.cpp	2006-09-29 23:08:18.000000000 -0400
@@ -78,7 +78,6 @@
 int listing_wrap_offset = 0;
 
 QString lastdduserid;
-DataDirectProcessor ddprocessor;
 QString graboptions = "";
 QString cardtype = QString::null;
 
@@ -879,17 +878,19 @@
 }
 
 // DataDirect stuff
-void DataDirectStationUpdate(Source source, bool update_icons = true)
+void DataDirectStationUpdate(Source source,
+			     DataDirectProcessor &ddprocessor,
+			     bool update_icons = true)
 {
-    DataDirectProcessor::UpdateStationViewTable(source.lineupid);
+    ddprocessor.UpdateStationViewTable(source.lineupid);
 
     bool insert_channels = insert_chan(source.id);
-    int new_channels = DataDirectProcessor::UpdateChannelsSafe(
+    int new_channels = ddprocessor.UpdateChannelsSafe(
         source.id, insert_channels);
 
     //  User must pass "--do-channel-updates" for these updates
     if (channel_updates)
-        DataDirectProcessor::UpdateChannelsUnsafe(source.id);
+        ddprocessor.UpdateChannelsUnsafe(source.id);
     // TODO delete any channels which no longer exist in listings source
 
     if (update_icons)
@@ -919,7 +920,7 @@
     }
 }
 
-bool DataDirectUpdateChannels(Source source)
+bool DataDirectUpdateChannels(DataDirectProcessor &ddprocessor, Source source)
 {
     ddprocessor.SetListingsProvider(DD_ZAP2IT);
     ddprocessor.SetUserID(source.userid);
@@ -931,7 +932,7 @@
     raw_lineup = source.id;
 
     if (ok)
-        DataDirectStationUpdate(source, false);
+        DataDirectStationUpdate(source, ddprocessor, false);
 
     return ok;
 }
@@ -1030,7 +1031,8 @@
     //cerr << "Done...\n";
 }
 
-bool grabDDData(Source source, int poffset, QDate pdate, int ddSource) 
+bool grabDDData(Source source, int poffset, QDate pdate, int ddSource,
+		DataDirectProcessor &ddprocessor) 
 {
     ddprocessor.SetListingsProvider(ddSource);
     ddprocessor.SetUserID(source.userid);
@@ -1111,13 +1113,13 @@
     if (!channel_update_run)
     {
         VERBOSE(VB_GENERAL, "Updating myth channels.");
-        DataDirectStationUpdate(source);
+        DataDirectStationUpdate(source, ddprocessor);
         VERBOSE(VB_GENERAL, "Channels updated.");
         channel_update_run = true;
     }
 
     //cerr << "Creating program view table...\n";
-    DataDirectProcessor::UpdateProgramViewTable(source.id);
+    ddprocessor.UpdateProgramViewTable(source.id);
     //cerr <<  "Finished creating program view table...\n";
 
     myMonitor->hibernate();
@@ -2618,12 +2620,14 @@
     return secsSince1Jan1970UTC;
 }
 
-bool grabData(Source source, int offset, QDate *qCurrentDate = 0)
+bool grabData(DataDirectProcessor &ddprocessor,
+	      Source source, int offset, QDate *qCurrentDate = 0)
 {
     QString xmltv_grabber = source.xmltvgrabber;
 
     if (xmltv_grabber == "datadirect")
-        return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT);
+        return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT,
+			  ddprocessor);
     else if (xmltv_grabber == "technovera")
     {
         VERBOSE(VB_ALL, "This grabber is no longer supported");
@@ -2816,7 +2820,9 @@
 }
 
 void grabDataFromDDFile(int id, int offset, const QString &filename,
-        const QString &lineupid, QDate *qCurrentDate = 0)
+			const QString &lineupid,
+			DataDirectProcessor &ddprocessor,
+			QDate *qCurrentDate = 0)
 {
     QDate *currentd = qCurrentDate;
     QDate qcd = QDate::currentDate();
@@ -2832,7 +2838,7 @@
     s.password = "fromfile";
     s.lineupid = lineupid;
 
-    grabData(s, offset, currentd);
+    grabData(ddprocessor, s, offset, currentd);
 }
 
 void clearOldDBEntries(void)
@@ -2962,7 +2968,8 @@
  *         program info grabbed with the associated grabber.
  *  \return true if there was no failures
  */
-bool fillData(QValueList<Source> &sourcelist)
+bool fillData(QValueList<Source> &sourcelist,
+	      DataDirectProcessor &ddprocessor)
 {
     QValueList<Source>::Iterator it;
 
@@ -3009,17 +3016,17 @@
         {
             // These don't support the --offset option, so just grab the max.
             // TODO: tv_grab_fi/dk/is seems to support --offset, maybe more. Needs verification.
-            if (!grabData(*it, 0))
+	    if (!grabData(ddprocessor, *it, 0))
                 ++failures;
         }
         else if ((xmltv_grabber == "datadirect") && dd_grab_all)
         {
             if (only_update_channels)
-                DataDirectUpdateChannels(*it);
+		DataDirectUpdateChannels(ddprocessor, *it);
             else
             {
                 QDate qCurrentDate = QDate::currentDate();
-                grabData(*it, 0, &qCurrentDate);
+                grabData(ddprocessor, *it, 0, &qCurrentDate);
             }
         }
         else if (xmltv_grabber == "datadirect" ||
@@ -3064,7 +3071,7 @@
 
             if ((xmltv_grabber == "datadirect") && only_update_channels)
             {
-                DataDirectUpdateChannels(*it);
+		DataDirectUpdateChannels(ddprocessor, *it);
                 grabdays = 0;
             }
 
@@ -3238,7 +3245,7 @@
                 {
                     VERBOSE(VB_IMPORTANT,
                             QString("Refreshing data for ") + currDate);
-                    if (!grabData(*it, i, &qCurrentDate))
+                    if (!grabData(ddprocessor, *it, i, &qCurrentDate))
                     {
                         ++failures;
                         if (interrupted)
@@ -3949,7 +3956,9 @@
 
     gContext->LogEntry("mythfilldatabase", LP_INFO,
                        "Listings Download Started", "");
-    
+
+    DataDirectProcessor ddprocessor;
+
     JobMonitor jobMonitor(-1);
 
     myMonitor= &jobMonitor;
@@ -4033,7 +4042,7 @@
     else if (from_dd_file)
     {
         grabDataFromDDFile(fromfile_id, fromfile_offset, fromfile_name,
-                fromddfile_lineupid);
+			   fromddfile_lineupid, ddprocessor);
         clearOldDBEntries();
     }
     else
@@ -4098,7 +4107,7 @@
              return FILLDB_EXIT_DB_ERROR;
         }
     
-        if (!fillData(sourcelist))
+        if (!fillData(sourcelist, ddprocessor))
         {
              VERBOSE(VB_IMPORTANT, "Failed to fetch some program info");
              gContext->LogEntry("mythfilldatabase", LP_WARNING,
