--- dbox2epg.cpp	2005-09-22 22:15:53.000000000 +0100
+++ /media/dbox2epg.cpp	2005-09-18 15:38:47.000000000 +0100
@@ -67,8 +67,22 @@
         // Wait before processing
 	usleep(waitTime);
 
-	RequestEPG(m_requestedChannel);
-	m_pendingRequest = false;
+	// Only grab the EPG for this channel if useonairguide is set to 1
+	// Qstring::compare returns zero if both strings are equal
+
+	if (!QString::compare( CheckUseOnAirGuide(), "1") )
+		{
+			RequestEPG(m_requestedChannel);
+                        m_pendingRequest = false;
+		}
+
+	else
+		{
+		 // do nothing
+		printf (QString("Skipping EPG grab for channel %1 \n").arg(m_requestedChannel));
+		EPGFinished();
+		}
+
     }
 #ifdef DEBUG_DBOX2EPG
     VERBOSE(VB_IMPORTANT, QString("DBOXEPG#%1: Exiting Thread....").arg(m_cardid));
@@ -244,4 +258,19 @@
     } 
     return "";
 }
+QString DBox2EPG::CheckUseOnAirGuide()
+{
+    MSqlQuery query(MSqlQuery::InitCon());
+    query.prepare("SELECT useonairguide "
+                  "FROM channel "
+                  "WHERE "
+                  "channel.channum = :CHANNUM");
+    query.bindValue(":CHANNUM", m_requestedChannel);
 
+   if (query.exec() && query.isActive() && query.size() > 0)
+    {
+        query.next();
+        return query.value(0).toString();
+    }
+    return "";
+}
--- dbox2epg.h	2005-09-22 22:15:53.000000000 +0100
+++ /media/dbox2epg.h	2005-09-18 15:29:32.000000000 +0100
@@ -7,13 +7,9 @@
 #ifndef DBOX2EPG_H_
 #define DBOX2EPG_H_
 
-#include <map>
-using namespace std;
-
-#include <qhttp.h>
+#include "qhttp.h"
 #include <qobject.h>
 #include <qthread.h>
-
 #include "mythcontext.h"
 #include "tv_rec.h"
 #include "dbox2channel.h"
@@ -30,7 +26,6 @@
 	void RequestEPG(const QString& channelNumber);
 	void ScheduleRequestEPG(const QString& channelNumber);
 	void Shutdown();
-
     public slots:
         void httpRequestFinished(int requestID, bool error);
 
@@ -42,6 +37,7 @@
 	void UpdateDataBase(QString* chanID, QDateTime* startTime, QDateTime* endTime, QString* title, QString *description, QString *category);
 	QString DBox2EPG::ParseNextLine(QByteArray buffer, int* index, int size);
 	QString GetChannelID(const QString& channelnumber) ;
+	QString CheckUseOnAirGuide() ;
 	void run();
 
         QHttp* http;
